// GET api/task public IEnumerable <Task> Get() { TaskExpence taskExpence = new TaskExpence(); List <Task> tasks = taskExpence.GetTasks(); List <CompletedTask> completedTasks = taskExpence.GetCompletedTasks(); var _nonCompletedTasks = from a in tasks where !(from b in completedTasks where b.TaskID == a.TaskID select b.TaskID) .Contains(a.TaskID) select a; return(tasks.ToList()); }
// GET api/task/5 public IEnumerable <Task> Get(int id) { TaskExpence taskExpence = new TaskExpence(); List <Task> tasks = taskExpence.GetTasks(); List <CompletedTask> completedTasks = taskExpence.GetCompletedTasks(); var _nonCompletedTasks = from a in tasks where !(from b in completedTasks where b.TaskID == a.TaskID select b.TaskID) .Contains(a.TaskID) && (a.SheduledDate <= DateTime.Today.AddDays(7)) select a; return(_nonCompletedTasks); }