Exemple #1
0
        public async Task <IActionResult> GetTotalFee([FromQuery] TotalFeeRequestModel requestModel)
        {
            try
            {
                var totalFee = await _tollFeeService.GetTotalFee(requestModel.VehicleTypeToDomain(), requestModel.PassageDates.ToList());

                return(Ok(new TotalFeeResponseModel
                {
                    TotalFee = totalFee
                }));
            }
            catch (EnumCastException)
            {
                return(BadRequest("Unable to parse VehicleType input"));
            }
            catch (Exception e)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e));
            }
        }