public ActionResult Edit([Bind(Include = "id,serialNo,name,address,codeNo")] tbl_ZoneList tbl_zonelist) { if (ModelState.IsValid) { db.Entry(tbl_zonelist).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_zonelist)); }
// GET: /Zone/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_ZoneList tbl_zonelist = db.tbl_ZoneList.Find(id); if (tbl_zonelist == null) { return(HttpNotFound()); } return(View(tbl_zonelist)); }
public ActionResult Create([Bind(Include = "id,serialNo,name,address,codeNo")] tbl_ZoneList tbl_zonelist) { if (ModelState.IsValid) { db.tbl_ZoneList.Add(tbl_zonelist); ViewBag.message = "Zone Created Succesfully"; db.SaveChanges(); ModelState.Clear(); return(View()); //return RedirectToAction("Index"); } return(View(tbl_zonelist)); }
public JsonResult DeleteConfirmed(int id) { string success = string.Empty; // return Json(success, JsonRequestBehavior.AllowGet); tbl_ZoneList tbl_zonelist = db.tbl_ZoneList.Find(id); db.tbl_ZoneList.Remove(tbl_zonelist); int result = db.SaveChanges(); if (result > 0) { success = "Data delete successfully"; } // return Json(success, JsonRequestBehavior.AllowGet); return(Json(new { result = success })); }