示例#1
0
        public async Task <ActionResult> Delete(int id)
        {
            var forum = _forumRepositories.GetById(id);
            await _forumRepositories.Delete(forum.Id);

            return(RedirectToAction("Index"));
        }
示例#2
0
        public static void DeleteForum(int forumid)
        {
            ForumInfo forum = GetForum(forumid);
            IForum    dal   = Factory <IForum> .Create("Forum");

            dal.Delete(forum);
            Admin.UpdateForumCounts();
        }
示例#3
0
        public async Task <IActionResult> DeleteForum(Forum forum)
        {
            await _postService.DeletePostsInForum(forum.Id);

            await _forumService.Delete(forum.Id);

            return(RedirectToAction("Index", "Forum"));
        }
示例#4
0
        public async Task <IActionResult> Delete(int forumId)
        {
            await DeleteForumPosts(forumId);

            await _forumService.Delete(forumId);

            return(RedirectToAction("Index", "Forum"));
        }
        public async Task <IActionResult> ConfirmDelete(int id)
        {
            var forum   = _forumService.GetById(id);
            var groupId = forum.GroupId;
            await _forumService.Delete(id);

            return(RedirectToAction("ChosenGroupAsync", "Group", new { id = groupId }));
        }
示例#6
0
        public static void DeleteForum(ForumInfo forum)
        {
            if (forum == null)
            {
                return;
            }
            IForum dal = Factory <IForum> .Create("Forum");

            dal.Delete(forum);
        }
        public async Task Delete(Group group)
        {
            var forums = _forumService.GetByGroupId(group.Id).ToList();

            foreach (var forum in forums)
            {
                await _forumService.Delete(forum.Id);
            }
            var usersId = _usersGroupsService.GetUsersByGroupId(group.Id).ToList();

            foreach (var userId in usersId)
            {
                await _usersGroupsService.DeleteUserGroup(userId, group.Id);
            }

            _context.Remove(group);
            await _context.SaveChangesAsync();
        }
示例#8
0
        public async Task <IActionResult> ConfirmDelete(int id)
        {
            var forum = _forumService.GetById(id);
            var posts = _postService.GetPostsByForum(id);

            if (posts.Any())
            {
                foreach (var post in posts.ToList())
                {
                    if (post.Replies.Any())
                    {
                        foreach (var reply in post.Replies.ToList())
                        {
                            if (System.IO.File.Exists(_environment.WebRootPath + reply.ImageUrl))
                            {
                                System.IO.File.Delete(_environment.WebRootPath + reply.ImageUrl);
                            }
                            await _userService.DecrementUserRating(reply.User.Id, typeof(PostReply));

                            await _postService.DeleteReply(reply.Id);
                        }
                    }
                    if (System.IO.File.Exists(_environment.WebRootPath + post.ImageUrl))
                    {
                        System.IO.File.Delete(_environment.WebRootPath + post.ImageUrl);
                    }
                    await _userService.DecrementUserRating(post.User.Id, typeof(Post));

                    await _postService.DeletePost(post.Id);
                }
            }
            if (System.IO.File.Exists(_environment.WebRootPath + forum.ImageUrl))
            {
                System.IO.File.Delete(_environment.WebRootPath + forum.ImageUrl);
            }
            await _forumService.Delete(forum.Id);

            return(RedirectToAction("Index", "Forum"));
        }
示例#9
0
 public IActionResult DeleteConfirmed(int id)
 {
     _forum.Delete(id);
     return(RedirectToAction("Index"));
 }
示例#10
0
        public async Task <IActionResult> Delete(int id)
        {
            await _forumService.Delete(id);

            return(RedirectToAction("Index", "Home"));
        }
示例#11
0
        //Delete Forum
        public async Task <IActionResult> Delete(int Id)
        {
            await _forumService.Delete(Id);

            return(RedirectToAction(nameof(Index)));
        }
示例#12
0
 public IActionResult Delete(int id)
 {
     _forumService.Delete(id);
     return(RedirectToAction("Index", "Forum"));
 }