Example #1
0
 //Delete action only for the Administrator
 public ActionResult Delete(int id)
 {
     if (IsAdmin)
     {
         Post post = GetPost(id);
         model.DeleteObject(post);
         model.SaveChanges();
     }
     //After delete render to the Index page displaying rest of the posts
     return(RedirectToAction("Index"));
 }