public JsonResult Action(CityActionModel model) { bool result; if (model.ID > 0) { City objectFirst = service.GetByID(model.ID); PropertyCopy.Copy(model, objectFirst); result = service.Update(objectFirst); } else { City objectFirst = new City { Name = model.Name, ProvinceID = model.ProvinceID }; result = service.Save(objectFirst); } JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = "" }) : (new { Success = false, Msg = "Unable to Save Course" }) }; return(jsonResult); }
public ActionResult Delete(int ID) { City objectFirst = service.GetByID(ID); CityActionModel model = new CityActionModel(); PropertyCopy.Copy(objectFirst, model); return(PartialView("_Delete", model)); }
public ActionResult Delete(CityActionModel model) { City objectFirst = service.GetByID(model.ID); bool result = service.Delete(objectFirst); JsonResult jsonResult = new JsonResult { Data = result ? (new { Success = true, Msg = "" }) : (new { Success = false, Msg = "Unable to Save Department" }), }; return(jsonResult); }
public ActionResult Action(int?ID) { CityActionModel model = new CityActionModel(); if (ID.HasValue) { City objectFirst = service.GetByID(ID.Value); PropertyCopy.Copy(objectFirst, model); } model.Provinces = provinceService.GetAll(); return(PartialView("_Action", model)); }