public ActionResult Create(Chapter33_BlogLib.Category entity) { try { dal.InsertEntity(entity); dal.SaveChange(); return(RedirectToAction("Index")); } catch (Exception e) { return(View()); } }
public ActionResult Delete(int id) { try { Chapter33_BlogLib.Category entity = dal.GetEntity(c => c.CategoryID == id); dal.DeleteEntity(entity); dal.SaveChange(); return(RedirectToAction("Index")); } catch (Exception e) { throw new Exception(); } }