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