public override void ExtraDelete(Task task) { LogWorkRepo repoWork = new LogWorkRepo(); CommentRepo repoComment = new CommentRepo(); List <Comment> comments = repoComment.GetAll().ToList(); List <LogWork> work = repoWork.GetAll().ToList(); foreach (Comment item in comments) { if (item.taskId == task.Id) { repoComment.Delete(item); } } foreach (LogWork item in work) { if (item.TaskId == task.Id) { repoWork.Delete(item); } } }
public override void ExtraDelete(User user) { TaskRepo repoTask = new TaskRepo(); LogWorkRepo repoWork = new LogWorkRepo(); CommentRepo repoComment = new CommentRepo(); List <Task> tasks = repoTask.GetAll(t => t.creatorId == user.Id).ToList(); List <Comment> comments = repoComment.GetAll().ToList(); List <LogWork> works = repoWork.GetAll().ToList(); foreach (Task item in tasks) { foreach (Comment comment in comments) { if (comment.taskId == item.Id) { repoComment.Delete(comment); } } foreach (LogWork work in works) { if (work.TaskId == item.Id) { repoWork.Delete(work); } } repoTask.Delete(item); } }
public ActionResult DeleteComment(DeleteCommentVM delete) { CommentRepo repo = new CommentRepo(); Comment deletedComment = repo.GetById(Convert.ToInt32(delete.Id)); repo.Delete(deletedComment); return(RedirectToAction("Details", "TaskManagement", new { id = Convert.ToInt32(deletedComment.taskId) })); }
protected override void DeleteFilter(int id) { CommentRepo comRepository = RepositoryFactory.GetCommentsRepository(); List <Comment> comments = comRepository.GetAll().FindAll(com => com.TaskId == id); foreach (var com in comments) { comRepository.Delete(com); } LoggedWorkRepo loggedWorkRepo = RepositoryFactory.GetLoggedWorksRepository(); List <LoggedWork> loggedWorks = loggedWorkRepo.GetAll().FindAll(lw => lw.TaskId == id); foreach (var lw in loggedWorks) { loggedWorkRepo.Delete(lw); } }
protected override void DeleteFilter(int id) { TaskRepo taskRepository = RepositoryFactory.GetTasksRepository(); List <Task> tasks = taskRepository.GetAll().FindAll(task => task.UserId == id && task.ResponsibleUser == id); foreach (var task in tasks) { taskRepository.Delete(task); } List <Task> tasksRespU = taskRepository.GetAll(); foreach (var task in tasksRespU) { if (task.ResponsibleUser == AuthenticationManager.LoggedUser.Id) { task.UserId = AuthenticationManager.LoggedUser.Id; taskRepository.Save(task); } } CommentRepo comRepository = RepositoryFactory.GetCommentsRepository(); List <Comment> comments = comRepository.GetAll().FindAll(com => com.CreatedBy == id); foreach (var com in comments) { comRepository.Delete(com); } LoggedWorkRepo loggedWorkRepo = RepositoryFactory.GetLoggedWorksRepository(); List <LoggedWork> loggedWorks = loggedWorkRepo.GetAll().FindAll(lw => lw.UserId == id); foreach (var lw in loggedWorks) { loggedWorkRepo.Delete(lw); } }
public void DeleteComment(Comment comment) { _CommentRepo.Delete(comment); }