public IQueryable<Project> GetProjects()
        {
            KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();

            var result = from prj in kt.Projects
                         select prj;
            return result;
        }
        public IQueryable<ProjectStatus> GetProjectStatuses( int projectID)
        {
            KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();

            var result = from prj in kt.ProjectStatus1
                         where prj.ProjectID == projectID
                         select prj;
            return result;
        }
 public bool Delete(Task task)
 {
     KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();
     Task t = new Task() { TaskID = task.TaskID };
     kt.Tasks.Attach(t);
     kt.Tasks.Remove(t);
     kt.SaveChanges();
     return true;
 }
        public IQueryable<User> GetProjectUsers(int projectID)
        {
            KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();

            var result = from prj in kt.Projects
                         from usr in prj.Users
                         where prj.ProjectID == projectID
                         select usr;
            return result;
        }
        public ICollection<Project> GetProjectsForUser(int userID)
        {
            KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();

            var result = from usr in kt.Users
                         where usr.UserID == userID
                         select usr;
            foreach (var usr in result)
            {
                return usr.Projects;
            }
            return null;
        }
        public ICollection<BoardItem> GetProjectBoard(int projectID)
        {
            KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();

            List<BoardItem> lst = new List<BoardItem>();
            var result = kt.GetProjectBoard(projectID);

            foreach (var res in result)
            {
                lst.Add(new BoardItem(res));
            }
            return lst;
        }
 public Task UpdateTask(Task task)
 {
     Task ret = null;
     KanbanBoard.Data.KanbanTFSEntities kt = new KanbanTFSEntities();
     bool taskFound = false;
     var result = from tsk in kt.Tasks
                  where tsk.TaskID == task.TaskID
                  select tsk;
     foreach (var tsk in result)
     {
         taskFound = true;
         tsk.ProjectID = task.ProjectID;
         tsk.TFSTaskID = task.TFSTaskID;
         tsk.Title = task.Title;
         tsk.Descriptions = task.Descriptions;
         tsk.UserID = task.UserID;
         tsk.StatusID = task.StatusID;
         ret = tsk;
     }
     if (taskFound == false)
     {
         ret = task;
         kt.Tasks.Add(task);
     }
     kt.SaveChanges();
     return ret;
 }