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); } }