public JsonResult Delete(AccomodationActionModel model) { JsonResult json = new JsonResult(); var result = false; var accomodation = accomodatioService.GetAllAccomodationByID(model.ID); result = accomodatioService.DeleteAccomodation(accomodation); if (result) { json.Data = new { Success = true }; } else { json.Data = new { Success = false, Message = "Unable to perform action on Accomodation" }; } return(json); }
public JsonResult Delete(Accomodations model) { var json = new JsonResult(); var error = ""; var result = false; try { result = _service.DeleteAccomodation(model.ID); } catch (Exception exp) { error = exp.Message + " " + exp.InnerException.Message; } if (result) { json.Data = new { Success = true, Link = Url.Action("Listing", "Accomodation"), Message = Status.Successfull }; } else { json.Data = new { Success = false, Link = Url.Action("Listing", "Accomodation"), Message = Status.Failed + " " + error }; } return(json); }