Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. [System.Web.Mvc.Route("BuildingTH")]
  2. [System.Web.Mvc.HttpPost()]
  3. [System.Web.Mvc.ActionName("FindListBuilding")]
  4. public HttpResponseMessage FindListBuilding([FromBody] BuildingContentViewModel mydata)
  5. {
  6. HttpResponseMessage response = default(HttpResponseMessage);
  7. try
  8. {
  9. if (DomainModelBase.IsAuthenticated() == "l")
  10. {
  11. response = Request.CreateResponse(HttpStatusCode.OK, new
  12. {
  13. Result = "login",
  14. //Data = GenerateTableRows(dt, "users")
  15. Data = "Please login"
  16. });
  17. return response;
  18. }
  19.  
  20. var model = new BuildingDomaineModel().GetListBuilding(mydata, true);
  21. if (model != null)
  22. {
  23. response = Request.CreateResponse(HttpStatusCode.OK, new
  24. {
  25. Result = "success",
  26. //Data = GenerateTableRows(dt, "users")
  27. Data = model
  28. });
  29. }
  30. else
  31. {
  32. response = Request.CreateResponse(HttpStatusCode.NotFound, new
  33. {
  34. Result = "Pleade insert the firstname",
  35. // Data = GenerateTableRows(dt, "users")
  36. });
  37. }
  38.  
  39. }
  40. catch (Exception ex)
  41. {
  42. response = Request.CreateResponse(HttpStatusCode.InternalServerError, new
  43. {
  44. result = "error",
  45. data = ex
  46. });
  47. }
  48.  
  49.  
  50. return response;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement