/// <summary> /// Updates the assignment. /// </summary> /// <param name="assignment">The assignment.</param> public void UpdateAssignment(AssignmentViewModel assignmentViewModel) { try { Assignment assignment = ObjectMapper.Map <AssignmentViewModel, Model.Entities.Assignment>(assignmentViewModel); AssignmentManager.Update(assignment); } catch (Exception ex) { ExceptionManager.HandleException(ex, PolicyNameType.ExceptionReplacing); } }
public IActionResult Put([FromBody] Assignment assignment) { // TODO: might need to change this a bit. Ids in the query but not used here? Not so sure about that. if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { Assignment updatedAssignment = assignmentManager.Update(assignment); return(Created($"assignments/{updatedAssignment.AgentId}/{updatedAssignment.RepId}/{updatedAssignment.PeriodId}", updatedAssignment)); } catch (Exception ex) { logger.LogError($"Failed to update assignment: {ex}"); return(BadRequest(config["Error:Default"])); } }