Beispiel #1
0
        public ActionResult Delete(long Id, int status)
        {
            ApiResponse rsp = new ApiResponse();

            _pageService.DeletePermanently(Id);
            //rsp.IsSuccess = true;
            //rsp.Message = "Page deleted successful";
            //rsp.Data = "";
            ViewBag.MessageType = "SuccessMessage";
            ViewBag.Message     = "Page deleted successful";
            return(RedirectToAction("Manage"));
        }
Beispiel #2
0
        public ActionResult Delete()
        {
            #region Comments Delete
            var comments = _commentsService.LoadAll(false);
            List <NccComment> commentsDeleteList = new List <NccComment>();
            foreach (var item in comments)
            {
                if (item.Metadata == "DEMODATA")
                {
                    commentsDeleteList.Add(item);
                }
            }
            foreach (var item in commentsDeleteList)
            {
                _commentsService.DeletePermanently(item.Id);
            }
            #endregion
            #region Post Delete
            var            post           = _postService.LoadAll(false);
            List <NccPost> postDeleteList = new List <NccPost>();
            foreach (var item in post)
            {
                if (item.Metadata == "DEMODATA")
                {
                    postDeleteList.Add(item);
                }
            }
            foreach (var item in postDeleteList)
            {
                _postService.DeletePermanently(item.Id);
            }
            #endregion
            #region Tag Delete
            var           tag           = _tagService.LoadAll(false);
            List <NccTag> tagDeleteList = new List <NccTag>();
            foreach (var item in tag)
            {
                if (item.Metadata == "DEMODATA")
                {
                    tagDeleteList.Add(item);
                }
            }
            foreach (var item in tagDeleteList)
            {
                _tagService.DeletePermanently(item.Id);
            }
            #endregion
            #region Category Delete
            var category = _categoryService.LoadAll(false);
            List <NccCategory> categoryDeleteList = new List <NccCategory>();
            foreach (var item in category)
            {
                if (item.Metadata == "DEMODATA")
                {
                    categoryDeleteList.Add(item);
                }
            }
            foreach (var item in categoryDeleteList)
            {
                _categoryService.DeletePermanently(item.Id);
            }
            #endregion
            #region Page Delete
            var            page           = _pageService.LoadAll(false);
            List <NccPage> pageDeleteList = new List <NccPage>();
            foreach (var item in page)
            {
                if (item.Metadata == "DEMODATA")
                {
                    pageDeleteList.Add(item);
                }
            }
            foreach (var item in pageDeleteList)
            {
                _pageService.DeletePermanently(item.Id);
            }
            #endregion
            ShowMessage("Demo data deleted successfully", Framework.Core.Mvc.Views.MessageType.Success, false, true);

            return(RedirectToAction("Index"));
        }