// GET: api/Projects //List<UserProject> userProjects = LogicUserProject.GetAllUserProject(); //List<Project> projects = LogicProjects.GetAllProjects(); public HttpResponseMessage Get() { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <List <Project> >(LogicProjects.GetAllProjects(), new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage GetActiveProjects() { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <List <Project> >(LogicProjects.GetAllProjects().Where(p => p.IsActive = true).ToList(), new JsonMediaTypeFormatter()) }); }
public static List<ProjectReport> CreateProjectReport() { List<Project> projects = LogicProjects.GetAllProjects(); List<ProjectReport> projectReports = new List<ProjectReport>(); foreach (Project project in projects) { List<User> allWorkers = new List<User>(); allWorkers = LogicManager.GetWorkersByProjectId(project.ProjectId); List<WorkerForProjectReport> workersForProjectReport = new List<WorkerForProjectReport>(); foreach (User worker in allWorkers) { WorkerForProjectReport workerForProjectReport = new WorkerForProjectReport(); workerForProjectReport = LogicManager.GetWorkerInfoForProjectReport(project.ProjectId, worker.UserId); workerForProjectReport.UserName = worker.UserName; workersForProjectReport.Add(workerForProjectReport); } projectReports.Add(new ProjectReport { ProjectInfo = project, ProjectStateByPrecents = LogicProjects.GetProjectState(project.ProjectId), Workers = workersForProjectReport }); } return projectReports; }
public HttpResponseMessage GetProjectsByTeamId(int teamLeaderId) { List <Project> projects = LogicProjects.GetAllProjects(); projects = projects.Where(u => u.TeamLeaderId == teamLeaderId).ToList(); if (projects.Count > 0) { return new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <List <Project> >(projects, new JsonMediaTypeFormatter()) } } ; else { return(new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new ObjectContent <String>("there is not projects", new JsonMediaTypeFormatter()) }); } }
public HttpResponseMessage Get() { return(Request.CreateResponse(HttpStatusCode.OK, LogicProjects.GetAllProjects())); }