mvc3 ActionResult does not reload page if is already on it

Posted by senzacionale on Stack Overflow See other posts from Stack Overflow or by senzacionale
Published on 2011-11-21T09:28:59Z Indexed on 2011/11/21 9:52 UTC
Read the original article Hit count: 161

Filed under:
|
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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc-3