public ActionResult Action(int?Id) { AccomodationTypeActionViewModel objAccomodationTypeActionViewModel = new AccomodationTypeActionViewModel(); if (Id.HasValue) //we are tyring to edit { var data = objAccomodationTypesService.GeAccomodationTypeById(Id.Value); objAccomodationTypeActionViewModel.Id = data.Id; objAccomodationTypeActionViewModel.Name = data.Name; objAccomodationTypeActionViewModel.Description = data.Description; } return(PartialView("_Action", objAccomodationTypeActionViewModel)); }
public JsonResult Delete(AccomodationTypeActionViewModel modal) { JsonResult Json = new JsonResult(); var result = false; AccomodationTypesService objAccomodationTypesService = new AccomodationTypesService(); var data = objAccomodationTypesService.GeAccomodationTypeById(modal.Id); // data.Id = modal.Id; result = objAccomodationTypesService.DeleteAccomodationType(data); if (result) { Json.Data = new { Success = true }; } else { Json.Data = new { Success = false, Message = "Unable to Delete" }; } return(Json); }
public JsonResult Action(AccomodationTypeActionViewModel modal) { JsonResult Json = new JsonResult(); var result = false; AccomodationTypesService objAccomodationTypesService = new AccomodationTypesService(); if (modal.Id > 0) //we are tyring to edit { var data = objAccomodationTypesService.GeAccomodationTypeById(modal.Id); // data.Id = modal.Id; data.Name = modal.Name; data.Description = modal.Description; result = objAccomodationTypesService.UpdateAccomodationType(data); } else { accomodationType.Name = modal.Name; accomodationType.Description = modal.Description; result = objAccomodationTypesService.SaveAccomodationType(accomodationType); } if (result) { Json.Data = new { Success = true }; } else { Json.Data = new { Success = false, Message = "Unable to save" }; } return(Json); }