Exemplo n.º 1
0
 public ActionResult Create(Chapter33_BlogLib.Category entity)
 {
     try
     {
         dal.InsertEntity(entity);
         dal.SaveChange();
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         return(View());
     }
 }
Exemplo n.º 2
0
 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();
     }
 }