public ActionResult SalaryDetails([FromQuery] string empCode, [FromQuery][Range(1, 12)] int month, [FromQuery][Range(1, int.MaxValue, ErrorMessage = "Year must be greater than 0.")] int year) { try { var salary = employeeApiService.GetSalaryDetails(empCode, month, year); return(new JsonResult(salary)); } catch (Exception ex) { this.logger.LogError(ex, $"Error while getting salary for empCode : {empCode}, month: {month}, year: {year}."); this.Response.StatusCode = (int)HttpStatusCode.InternalServerError; return(new JsonResult(new { Error = new { Message = "An unhandled error occured during request processing." } })); } }