mvc3 ActionResult does not reload page if is already on it
- by senzacionale
public ActionResult DeleteCategory(int id)
{
CategoryManager manager = new CategoryManager();
manager.DeleteCategory(id);
TempData["IsDeleted"] = true;
return RedirectToAction("CategoriesList");
}
public ActionResult CategoriesList()
{
List<CategoryModel> model = new CategoryManager().GetAll();
return View(model);
}
public void DeleteCategory(int categoryId)
{
using (AsoEntities context = new AsoEntities())
{
var categoryToDelete = (from c in context.Categories
where c.Id == categoryId
select c).SingleOrDefault();
if (categoryToDelete == null)
return;
context.Categories.DeleteObject(categoryToDelete);
context.SaveChanges();
}
}
when i delete article i go back to CategoriesList but page is not reloaded if i am already on CategoriesList. What to do that page will be reloaded and data will be changed?