public GetProjectResponse GetProject(GetProjectRequest request) { GetProjectResponse response = new GetProjectResponse(); try { ProjectService service = new ProjectService(_projectRepository); if (request.All) { ProjectAssignmentsViewModel viewModel = new ProjectAssignmentsViewModel(); viewModel.Projects = service.GetAllProjects().AsEnumerable(); response.ProjectAssignments = viewModel; } if (request.Id != 0) { AssignProjectInputModel assignProject = new AssignProjectInputModel(); assignProject.Project = service.GetProject(request.Id); assignProject.PersonsToAssign = GetPersonsToAssign(assignProject.Project); response.AssignProject = assignProject; } response.Success = true; } catch (Exception ex) { response.Success = false; response.Message = "Something went wrong: " + ex.ToString(); } return response; }
public ActionResult Assignments(int projectId) { GetProjectRequest request = new GetProjectRequest(); request.Id = projectId; GetProjectResponse response = _projectService.GetProject(request); return View(response.AssignProject); }
// // GET: /Projects/ public ActionResult Index() { GetProjectRequest request = new GetProjectRequest(); request.All = true; GetProjectResponse respose = _projectService.GetProject(request); if (respose.Success) { return View(respose.ProjectAssignments); } return View("Error"); }