Advertisement
gladyssann

UserController.cs

Jan 8th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. public ActionResult DeleteUser(int id)
  2. {
  3. UserBusinessLayer userService = new UserBusinessLayer("sqlconn");
  4.  
  5. UserModel userModel = new UserModel();
  6.  
  7. try
  8. {
  9. UserEntity userEntity = userService.GetUserId(id);
  10.  
  11.  
  12. userModel.usr_Id = userEntity.usr_Id;
  13. userModel.email = userEntity.email;
  14. userModel.username = userEntity.username;
  15. userModel.password = userEntity.password;
  16.  
  17.  
  18. }
  19. catch (Exception ex)
  20. {
  21.  
  22. throw ex;
  23. }
  24.  
  25. return View(userModel);
  26. }
  27.  
  28. [HttpPost, ActionName("DeleteUser")]
  29. public ActionResult DeleteUserConfirmed(int id)
  30. {
  31. UserBusinessLayer userService = new UserBusinessLayer("sqlconn");
  32.  
  33. userService.DeleteUser(new UserEntity(){
  34.  
  35. usr_Id = id
  36. });
  37.  
  38. return RedirectToAction("List");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement