public async Task <BookingTransportRes> BookingTransport(BookingTransportReq request) { try { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@CustomerId", request.CustomerId); parameters.Add("@DiscountId", request.DiscountId); parameters.Add("@Distance", request.Distance); parameters.Add("@UnitPrice", request.UnitPrice); parameters.Add("@PickedUpLatitude", request.PickedUpLatitude); parameters.Add("@PickedUpLongitude", request.PickedUpLongitude); parameters.Add("@DropedOffLatitude", request.DropedOffLatitude); parameters.Add("@DropedOffLongitude", request.DropedOffLongitude); parameters.Add("@OriginAddress", request.OriginAddress); parameters.Add("@DestinationAddress", request.DestinationAddress); return(await SqlMapper.QueryFirstAsync <BookingTransportRes>( cnn : connection, sql : "sp_BookingTransport", param : parameters, commandType : CommandType.StoredProcedure)); } catch (Exception ex) { throw ex; } }
public async Task <BookingTransportRes> BookingTransport(BookingTransportReq request) { try { if (request != null) { return(await customerRepository.BookingTransport(request)); } return(new BookingTransportRes() { BookingId = "", Message = "Có lỗi xảy ra, xin hãy liên hệ với tổng đài để khắc phục" }); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> BookingTransport(BookingTransportReq request) { return(Ok(await customerService.BookingTransport(request))); }