public void Execute(RegisterUserDto request) { validator.ValidateAndThrow(request); var user = mapper.Map <User>(request); user.Password = EasyEncryption.SHA.ComputeSHA256Hash(request.Password); context.Add(user); context.SaveChanges(); int id = user.Id; foreach (var uc in useCasesForUser) { context.UserUseCases.Add(new UserUseCases { UserId = id, UseCaseId = uc }); } context.SaveChanges(); email.Send(new SendEmailDto { Content = "<h2>Uspesno ste se registrovali. Arts Team</h2>", SendTo = request.Email, Subject = "Successful registration" }); }
public void Execute(CommentDto request) { validator.ValidateAndThrow(request); request.UserId = actor.Id; var comment = mapper.Map <Comment>(request); context.Add(comment); context.SaveChanges(); }
public void Execute(UserUseCaseDto request) { validator.ValidateAndThrow(request); var useCase = mapper.Map <UserUseCases>(request); context.Add(useCase); context.SaveChanges(); }
public void Execute(UserDto request) { validator.ValidateAndThrow(request); var user = mapper.Map <User>(request); user.Password = EasyEncryption.SHA.ComputeSHA256Hash(request.Password); context.Add(user); context.SaveChanges(); int id = user.Id; foreach (var uc in useCasesForUser) { context.UserUseCases.Add(new UserUseCases { UserId = id, UseCaseId = uc }); } context.SaveChanges(); }