Beispiel #1
0
 public async Task <User> FindAsync(Guid userId)
 {
     using (SimpleCQRSContext db = _dbContextFactory.Invoke())
     {
         return(await db.Users
                .Where(x => x.Id == userId)
                .SingleOrDefaultAsync());
     }
 }
Beispiel #2
0
 public async Task <UserPresentation> FindByIdAsync(Guid userId)
 {
     using (SimpleCQRSContext db = _dbContextFactory.Invoke())
     {
         return(await db.Users
                .FilterById(userId)
                .ToPresentation()
                .SingleOrDefaultAsync());
     }
 }
Beispiel #3
0
        public async Task InsertAsync(User user)
        {
            if (null == user)
            {
                throw new ArgumentNullException(nameof(user));
            }

            using (SimpleCQRSContext db = _dbContextFactory.Invoke())
            {
                db.Users.Add(user);
                await db.SaveChangesAsync();
            }
        }