public IActionResult UpdateLine(Guid timesheetId, Guid lineId, [FromBody] DocumentLine documentLine) { logger.LogInformation($"Looking for timesheet {timesheetId} with line {lineId}"); Timecard timecard = repository.Find(timesheetId); if (timecard != null) { if (timecard.Status != TimecardStatus.Draft) { return(StatusCode(409, new InvalidStateError() { })); } if (!timecard.HasLine(lineId)) { return(StatusCode(409, new LineNotFoundError() { })); } var updatedLine = timecard.updateLine(lineId, documentLine); repository.Update(timecard); return(Ok(updatedLine)); } else { return(NotFound()); } }
public IActionResult UpdateLine(string timecardId, string lineId, [FromBody] TimecardLine timecardLine) { Timecard timecard = Database.Find(timecardId); if (timecard == null) { return(NotFound()); } if (!timecard.containsLine(lineId)) { return(NotFound()); } timecard.updateLine(lineId, timecardLine); return(Ok()); }