public async Task <ActionResult> Delete(int id) { var forum = _forumRepositories.GetById(id); await _forumRepositories.Delete(forum.Id); return(RedirectToAction("Index")); }
public static void DeleteForum(int forumid) { ForumInfo forum = GetForum(forumid); IForum dal = Factory <IForum> .Create("Forum"); dal.Delete(forum); Admin.UpdateForumCounts(); }
public async Task <IActionResult> DeleteForum(Forum forum) { await _postService.DeletePostsInForum(forum.Id); await _forumService.Delete(forum.Id); return(RedirectToAction("Index", "Forum")); }
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 })); }
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(); }
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")); }
public IActionResult DeleteConfirmed(int id) { _forum.Delete(id); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(int id) { await _forumService.Delete(id); return(RedirectToAction("Index", "Home")); }
//Delete Forum public async Task <IActionResult> Delete(int Id) { await _forumService.Delete(Id); return(RedirectToAction(nameof(Index))); }
public IActionResult Delete(int id) { _forumService.Delete(id); return(RedirectToAction("Index", "Forum")); }