public IActionResult Details(int annualLeaveRequestId) { var annualLeaveRequest = _annualLeaveRequestLogic.GetRequest(annualLeaveRequestId); int year = annualLeaveRequest?.Year ?? DateTime.UtcNow.Year; var annualLeaveRequestDetailsViewModel = new AnnualLeaveRequestDetailsViewModel() { Year = year, AnnualLeaveRequest = annualLeaveRequest, IsEditable = year >= DateTime.UtcNow.Year, }; return(View(annualLeaveRequestDetailsViewModel)); }
public IActionResult Get(int annualLeaveRequestID) { try { var annualLeaveRequest = _annualLeaveRequestLogic.GetRequest(annualLeaveRequestID); if (annualLeaveRequest != null && annualLeaveRequest.Year > 0) { return(Ok(annualLeaveRequest)); } return(NoContent()); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, $"Error retrieving the annual leave request for annualLeaveRequestID: {annualLeaveRequestID}")); } }