Example #1
0
        public async Task <ActionResult> DeleteSection(int sectionId)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var result = false;

            if (sectionId > 0)
            {
                result = await SectionManager.DeleteSectionAsync(sectionId);

                if (result)
                {
                    _cache.Remove(CacheKeys.AllSections);
                }
            }

            if (result)
            {
                return(Json(new { success = true }));
            }

            return(ValidationProblem("The section wasn't deleted. Likely because it contained one or more forums. First delete the forums, then delete the section."));
        }