public ActionResult <AssignedRequestsDTO> PostAssignedRequestsDTO(AssignedRequestsDTO assignedRequestsDTO) { _assignedRequestsRepository.Add(assignedRequestsDTO); _assignedRequestsRepository.Save(); return(CreatedAtAction("GetAssignedRequestsDTO", new { id = assignedRequestsDTO.Id }, assignedRequestsDTO)); }
public void Update(AssignedRequestsDTO assignedRequestsDTO) { AssignedRequests assignedRequests = new AssignedRequests(); assignedRequests.TeamId = assignedRequestsDTO.TeamId; assignedRequests.RequestId = assignedRequestsDTO.RequestId; _context.Entry(assignedRequests).State = EntityState.Modified; }
public void Add(AssignedRequestsDTO assignedRequestsDTO) { AssignedRequests assignedRequests = new AssignedRequests(); assignedRequests.TeamId = assignedRequestsDTO.TeamId; assignedRequests.EmployeeId = assignedRequestsDTO.EmployeeId; assignedRequests.ProjectPositionId = assignedRequestsDTO.ProjectPositionId; assignedRequests.RequestId = assignedRequestsDTO.RequestId; _context.assignedRequests.Add(assignedRequests); }
public IActionResult PutAssignedRequestsDTO(int id, AssignedRequestsDTO assignedRequestsDTO) { if (id != assignedRequestsDTO.Id) { return(BadRequest()); } _assignedRequestsRepository.Add(assignedRequestsDTO); try { _assignedRequestsRepository.Save(); } catch (DbUpdateConcurrencyException ex) { string msg = ex.Message; } return(NoContent()); }
public AssignedRequestsDTO GetById(int id) { var assign = _context.assignedRequests.Include(a => a.ProjectPosition).Include(a => a.Employee) .Include(a => a.Team).Include(a => a.Request) .Where(a => a.Id == id).FirstOrDefault(); var assignedRequestsDTO = new AssignedRequestsDTO { Id = assign.Id, EmployeeId = assign.EmployeeId, EmployeeName = assign.Employee.EmployeeName, ProjectName = assign.Request.ProjectTeam.Project.ProjectName, TeamId = assign.TeamId, TeamName = assign.Team.Name, ProjectPositionId = assign.ProjectPositionId, ProjectPositionName = assign.ProjectPosition.PositionName, RequestId = assign.RequestId, RequestName = assign.Request.RequestName }; return(assignedRequestsDTO); }