Esempio n. 1
0
        public async Task <Unit> Handle(ActivateUserCommand request, CancellationToken cancellationToken)
        {
            var user = _context.Users.SingleOrDefault(x => x.Id == request.UserId);

            if (user == null)
            {
                throw new UserNotExistException(request.UserId);
            }
            user.Activate();
            await _context.SaveChangesAsync();

            return(Unit.Value);
        }
Esempio n. 2
0
 public async Task <bool> SaveChangesAsync()
 {
     return(await _context.SaveChangesAsync() >= 0);
 }