public ActionResult DeleteCategory(int id)
        {
            IntermediateCategory category = repositoryInter.Get(id);
            //ViewBag.CategoryName = category.NameOfMainCategory;

            bool result = repositoryInter.Remove(category);

            if (result == false)
            {
                ViewBag.ErrorMessage = "You have to keep at least one Category";
                return(View("Error"));
            }


            //return View("DeleteCategory");
            return(RedirectToAction("ChangeCategories", new { controller = "Admin", action = "ChangeCategories", id = category.MainCategoryByCitiesId }));
        }
Esempio n. 2
0
        public ViewResult Show_Topics(int id)
        {
            ViewBag.IntermediateCategory_Id = id;


            //List<Topic> TopicList = repositoryInter.Get(id).Topic.ToList();


            IntermediateCategory category = repositoryInter.Get(id);

            if (category.NameOfMainCategory == "Error")
            {
                return(View("Error"));
            }
            else
            {
                List <Topic> TopicList = category.Topic.ToList();
                return(View("Show_Topics", TopicList));
            }
        }