public JsonResult DeleteMunicipalityValuations(int?id) { MunicipalityContext ctx = new MunicipalityContext(); MunicipalityValuation data = (from valuation in ctx.MunicipalityValuations where valuation.MunicipalityValuationId == id select valuation).SingleOrDefault(); ctx.MunicipalityValuations.Remove(data); ctx.SaveChanges(); return(Json("Record Deleted Successfully", JsonRequestBehavior.AllowGet)); }
public ActionResult AddValuation(MunicipalityValuation model) { if (!ModelState.IsValid) { return(View(model)); } using (var ctx = new MunicipalityContext()) { ctx.MunicipalityValuations.Add(model); ctx.SaveChanges(); } return(RedirectToAction("ViewMunicipalityValuations", new { id = model.MunicipalityId })); }
// [HttpPost] public ActionResult EditValuation(int?id) { MunicipalityContext ctx = new MunicipalityContext(); MunicipalityValuation data = (from valuation in ctx.MunicipalityValuations where valuation.MunicipalityValuationId == id select valuation).SingleOrDefault(); ctx.MunicipalityValuations.Find(id); return(PartialView("~/Views/Shared/_EditValuation.cshtml", data)); }