public ActionResult Edit(int id, VDCMUNModel model) { if (ModelState.IsValid) { if (pro.EditVdcMun(id, model)) { TempData["Msg"] = "Data has been Updated succeessfully"; } else { TempData["MsgError"] = "Data has Not been Updated succeessfully"; } } return(RedirectToAction("Index")); }
public ActionResult Create(VDCMUNModel model) { if (ModelState.IsValid) { if (pro.InsertVdcMun(model)) { TempData["Msg"] = "Data has been Saved succeessfully"; } else { TempData["MsgError"] = "Data has Not been Saved succeessfully"; } } return(RedirectToAction("Index")); }
public bool EditVdcMun(int id, VDCMUNModel model) { using (EHMSEntities ent = new EHMSEntities()) { var obj = ent.VDCMUNs.ToList().Where(x => x.VdcMunID == id).FirstOrDefault(); obj.VdcMunNameEng = model.VdcMunNameEng; obj.DistrictID = model.DistrictID; int i = ent.SaveChanges(); if (i > 0) { return(true); } else { return(false); } } }
public bool InsertVdcMun(VDCMUNModel model) { using (EHMSEntities ent = new EHMSEntities()) { var objInsertVdcMun = new VDCMUN() { VdcMunNameEng = model.VdcMunNameEng, DistrictID = model.DistrictID }; ent.VDCMUNs.Add(objInsertVdcMun); int i = ent.SaveChanges(); if (i > 0) { return(true); } else { return(false); } } }
public ActionResult Edit(int id) { model = pro.PopulateRecords().Where(x => x.VdcMunID == id).FirstOrDefault(); return(View(model)); }