public ActionResult Edit(int id) { ZoneCategory a = (from c in db.ZoneCategories where c.ZoneCategoryID == id select c).FirstOrDefault(); ZoneCategoryVM v = new ZoneCategoryVM(); v.ZoneCategoryID = a.ZoneCategoryID; v.ZoneCategory = a.ZoneCategory1; v.StatusBaseCategory = a.StatusBaseCategory.Value; return(View(v)); }
public ActionResult DeleteConfirmed(int id) { ZoneCategory a = (from c in db.ZoneCategories where c.ZoneCategoryID == id select c).FirstOrDefault(); if (a == null) { return(HttpNotFound()); } else { db.ZoneCategories.Remove(a); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Deleted Zone Category."; return(RedirectToAction("Index")); } }
public ActionResult Create(ZoneCategoryVM v) { ZoneCategory a = new ZoneCategory(); if (ModelState.IsValid) { a.ZoneCategory1 = v.ZoneCategory; a.StatusBaseCategory = v.StatusBaseCategory; db.ZoneCategories.Add(a); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully added Zone Category."; return(RedirectToAction("Index")); } return(View()); }
public ActionResult Edit(ZoneCategoryVM v) { ZoneCategory a = new ZoneCategory(); if (ModelState.IsValid) { a.ZoneCategoryID = v.ZoneCategoryID; a.ZoneCategory1 = v.ZoneCategory; a.StatusBaseCategory = v.StatusBaseCategory; db.Entry(a).State = EntityState.Modified; db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Updated Zone Category."; return(RedirectToAction("Index")); } return(View()); }