public void UpdateUser(User user) { var uow = m_unitOfWorkFactory.Create(); m_userRepository.Update(user); uow.Commit(); }
public void CreateUser(User user) { ValidateUserCreate(user); //assign default value user.IsActive = true; var uow = m_unitOfWorkFactory.Create(); m_userRepository.Create(user); uow.Commit(); }
public ActionResult Create(UserCreateModel userCreateModel) { User user = new User(); Mapper.Map(userCreateModel, user); UserService.CreateUser(user); //Thread.Sleep(5000); this.ShowNotification(NotificationType.Success, "User berhasil ditambah", true); return RedirectToAction("Index"); //} //return View(); }
private void ValidateUserCreate(User user) { var errors = new List<ValidationResult>(); if(!IsLoginAvailable(user.Login)) { errors.Add(new ValidationResult(Resources.UserCreateModel_LoginAlreadyExist, new[] { "Login" })); throw ExceptionHandling.HandleBusinessValidation(errors); } }
public ActionResult Delete(UserUpdateModel userCreateUpdateModel) { //Thread.Sleep(5000); var userToDelete = new User(); Mapper.Map(userCreateUpdateModel, userToDelete); UserService.DeleteUser(userToDelete); this.ShowNotification(NotificationType.Success, "User berhasil dihapus", true); return RedirectToAction("Index"); }