Changeset 7fbb91c for ChapterX.Infrastructure
- Timestamp:
- 03/24/26 23:03:39 (3 months ago)
- Branches:
- main
- Children:
- a7550ca
- Parents:
- 73b69b2
- Location:
- ChapterX.Infrastructure/Repositories
- Files:
-
- 2 edited
-
CollaborationRepository.cs (modified) (2 diffs)
-
UserRepository.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ChapterX.Infrastructure/Repositories/CollaborationRepository.cs
r73b69b2 r7fbb91c 2 2 using ChapterX.Domain.Repositories; 3 3 using ChapterX.Infrastructure.Data.DataContext; 4 using System; 5 using System.Collections.Generic; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 4 using Microsoft.EntityFrameworkCore; 9 5 10 6 namespace ChapterX.Infrastructure.Repositories … … 15 11 { 16 12 } 13 14 public override async Task<IEnumerable<Collaboration>> GetAllAsync(CancellationToken cancellationToken = default) 15 => await _dbSet 16 .Include(c => c.User) 17 .ToListAsync(cancellationToken); 18 19 public async Task<bool> DeleteByUserAndStoryAsync(int userId, int storyId, CancellationToken cancellationToken = default) 20 { 21 var collab = await _dbSet.FirstOrDefaultAsync(c => c.UserId == userId && c.StoryId == storyId, cancellationToken); 22 if (collab == null) return false; 23 _dbSet.Remove(collab); 24 await _context.SaveChangesAsync(cancellationToken); 25 return true; 26 } 17 27 } 18 28 } -
ChapterX.Infrastructure/Repositories/UserRepository.cs
r73b69b2 r7fbb91c 12 12 } 13 13 14 public override async Task<IEnumerable<User>> GetAllAsync(CancellationToken cancellationToken = default) 15 => await _dbSet 16 .Include(u => u.Admin) 17 .Include(u => u.Writer) 18 .ToListAsync(cancellationToken); 19 14 20 public async Task<User?> GetByEmailAsync(string email, CancellationToken cancellationToken = default) 15 21 => await _dbSet
Note:
See TracChangeset
for help on using the changeset viewer.
