public ActionResult Delete(int id)
{
var post = DbContext.Posts.SingleOrDefault(p => p.Id == id);
if (post == null)
return HttpNotFound();
DbContext.Posts.Remove(post);
DbContext.SaveChanges();
if (Request.IsAjaxRequest())
{
return Json(new { success = true });
} else
{
return RedirectToAction("Index", "Home");
}
}