private void IterateThroughVehicles(TourClientViewModel tourClientModel, TransportPricing vehiclePayment, ref decimal runningCostItems) { foreach (var vh in tourClientModel.Vehicles) { switch (vh.VehicleType) { case Models.VehicleType.Taxi: runningCostItems += vh.AcutualNumberOfPassengersAllocated * vehiclePayment.TaxiPricing; break; case Models.VehicleType.TourBus: runningCostItems += vh.AcutualNumberOfPassengersAllocated * vehiclePayment.TourBusPricing; break; case Models.VehicleType.MiniBus: runningCostItems += vh.AcutualNumberOfPassengersAllocated * vehiclePayment.MiniBusPricing; break; case Models.VehicleType.PickUpTrack: runningCostItems += vh.AcutualNumberOfPassengersAllocated * vehiclePayment.PickupTruckPricing; break; case Models.VehicleType.FourWheelDriveCar: runningCostItems += vh.AcutualNumberOfPassengersAllocated * vehiclePayment.FourByFourPricing; break; } } }
public async Task <IActionResult> GetTransportPricingById(int transportPricingId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); TransportPricing tpresult = await _serviceEndPoint.GetTransportPricingById(transportPricingId); TransportPricingViewModel result = _Mapper.Map <TransportPricingViewModel>(tpresult); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }