public IActionResult Put(int id, [FromBody] TimesheetDto ts) { Timesheet timesheet = _timeSheetRepository.GetTimsheetById(ts.Id); if (ts.Status.Equals(TimesheetStatus.Approved.ToString())) { _logger.LogWarning($"About to approve timesheet for id: {ts.Id}"); timesheet.Approved(_mediator); } else if (ts.Status.Equals(TimesheetStatus.Rejected.ToString())) { _logger.LogWarning($"About to reject timesheet for id: {ts.Id}"); timesheet.Rejected(_mediator); } else if (ts.Status.Equals(TimesheetStatus.Submitted.ToString())) { _logger.LogWarning($"Timesheet Submitted for id: {ts.Id}"); timesheet.Submitted(_mediator); } _timeSheetRepository.UpdateTimesheet(timesheet); return(Ok()); }