public ActionResult Delete(Int64 id) { User user = UserService.GetUser(id); if (user == null) { this.ShowNotification(NotificationType.Info, "User tidak ditemukan", true); return RedirectToAction("Index"); } var userData = new UserUpdateModel(); Mapper.Map(user, userData); return View(userData); }
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"); }
public ActionResult Edit(UserUpdateModel userUpdateModel) { //ModelState.Remove("Password"); //ModelState.Remove("ConfirmPassword"); //Thread.Sleep(5000); //if (ModelState.IsValid) //{ User userToUpdate = UserService.GetUser(userUpdateModel.UserId); if (userToUpdate == null) { //this.ShowNotification(NotificationType.Info, "User tidak ditemukan", true); //return RedirectToAction("Index"); throw new CustomException(ExceptionType.DeletedByOtherUser, "", null); } Mapper.Map(userUpdateModel, userToUpdate); //userToUpdate.Login = "******"; UserService.UpdateUser(userToUpdate); this.ShowNotification(NotificationType.Success, "User berhasil diubah", true); return RedirectToAction("Index"); //} //return View(); }