public ActionResult DeleteConfirmed(int id) { categoryModels categoryModels = db.categoryData.Find(id); db.categoryData.Remove(categoryModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,categoryType,categoryDiscription")] categoryModels categoryModels) { if (ModelState.IsValid) { db.Entry(categoryModels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoryModels)); }
public ActionResult Create([Bind(Include = "Id,categoryType,categoryDiscription,productType")] categoryModels categoryModels) { if (ModelState.IsValid) { db.categoryData.Add(categoryModels); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoryModels)); }
// GET: category/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } categoryModels categoryModels = db.categoryData.Find(id); if (categoryModels == null) { return(HttpNotFound()); } return(View(categoryModels)); }