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 CreateProjectResponse CreateProject(CreateProjectRequest request) { CreateProjectResponse response = new CreateProjectResponse(); try { ProjectService service = new ProjectService(_projectRepository); service.AddProject(request.Project); response.Success = true; } catch (Exception ex) { response.Message = "Something went wrong: " + ex.ToString(); response.Success = false; } return response; }