public UndoneTaskPerProject GetUndoneTasks(Guid id)
 {
     using (var context = new DiplomaDBContext())
     {
         var project           = context.ListOfProjects.SingleOrDefault(x => x.Id == id);
         var taskService       = new ProjectTaskService();
         var listOfUndoneTasks = taskService.GetAllByProject(id).Where(x => x.EndDate == (DateTime)SqlDateTime.MinValue).OrderBy(x => x.DeadLine).ToList();
         return(new UndoneTaskPerProject()
         {
             Project = project, UndoneProjectTasks = listOfUndoneTasks
         });
     }
 }
 public int[] GetStatisticsDoneUndoneFailedTasks(Guid projectId)
 {
     using (var context = new DiplomaDBContext())
     {
         var taskService    = new ProjectTaskService();
         var doneTasksCount = taskService
                              .GetAllByProject(projectId)
                              .Count(x => x.EndDate != (DateTime)SqlDateTime.MinValue);
         var undoneTasksCount = taskService
                                .GetAllByProject(projectId)
                                .Count(x => x.EndDate == (DateTime)SqlDateTime.MinValue);
         var failedTasksCount = taskService
                                .GetAllByProject(projectId)
                                .Count(x => x.DeadLine < DateTime.Today && x.EndDate == (DateTime)SqlDateTime.MinValue);
         return(new[] { doneTasksCount, undoneTasksCount, failedTasksCount });
     }
 }