示例#1
0
        public ActionResult RejectPost(int id)
        {
            Models.PostVM post = _postService.FindById(id);
            if (post != null)
            {
                _postService.Remove(id);
                List <Models.ImagesGalleryVM> images = _imageGalleryService.Find(id).ToList();
                if (images.Count == 1)
                {
                    _imageGalleryService.RemoveItem(images[0]);
                }
                else
                {
                    _imageGalleryService.RemoveRange(images);
                }

                TempData["Message"] = "Пост был успешно отклонен";
            }
            else
            {
                TempData["Message"] = "Что-то пошло не так";
            }

            return(RedirectToAction("Index"));
        }
示例#2
0
        public IActionResult ResolvePost(int id)
        {
            Models.PostVM post = _postService.FindById(id);
            post.Status = "1";
            _postService.Update(post);
            TempData["Message"] = "Пост был успешно одобрен";

            return(RedirectToAction("Index"));
        }