예제 #1
0
        public IHttpActionResult Get([FromUri] PayrollRequestDataViewModel payrollRequest)
        {
            if (!ModelState.IsValid)
            {
                // TODO: add logs, add error info in responce message if required
                return(BadRequest("Request example: http://localhost:52039/api/payrollservice/SP?HoursWorked=20&HourlyRate=10&countrycode=SP"));
            }

            var payrollResult = _payrollService.GetCalculatedPayroll(
                payrollRequest.CountryCode,
                payrollRequest.HoursWorked,
                payrollRequest.HourlyRate);

            return(Ok(PayrollViewModel.Map(payrollResult)));
        }