public ActionResult Update(Category model) { try { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } catch (Exception Ex) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest, Ex.Message); } }
public ActionResult Add(Category model) { try { db.Categories.Add(model); db.SaveChanges(); return RedirectToAction("Index"); } catch (Exception Ex) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest, Ex.Message); } }