public async Task <BaseResult <bool> > ValidateUpdateAllocationRequest(UpdateAllocationsValidationRequest request) { BaseResult <bool> validationResponse = new BaseResult <bool>(); if (request == null || String.IsNullOrWhiteSpace(request.HotelCode) || request.ChannelManagerId == 0 || request.RoomTypeRatePlanList == null || !request.RoomTypeRatePlanList.Any() || !request.RoomTypeRatePlanList.Where(RT => RT.RoomTypeCode != null && RT.RatePlanCode != null).Any()) { validationResponse.IsError = true; validationResponse.Message = string.Format(Constants.ErrorMessage.RequiredFieldMissing, "Hotel Code, Channe manger Id, Room Types and Rate Plans "); validationResponse.ErrorCode = (int)Constants.ErrorCodes.RequiredFieldMissing; return(validationResponse); } validationResponse = await iChannelManager.ValidateUpdateAllocationRequest(request).ConfigureAwait(false); //if (!validationResponse.Result && validationResponse.IsError && validationResponse.ExceptionMessage != null) //{ // // return new StatusCodeResult(500); //} //if (!validationResponse.Result) //{ // // return new BadRequestObjectResult(validationResponse); //} return(validationResponse); //return Ok(validationResponse); // return await iChannelManager.ValidateRoomTypeRatePlanRequest(request).ConfigureAwait(false); }
public async Task <BaseResult <bool> > ValidateUpdateAllocationRequest(UpdateAllocationsValidationRequest request) { // DynamicParameters paramCollection = RequestMapper.CreateUpdateAllocationsValidationRequest(request); BaseResult <List <ChannelManagerRequestValidationResponse> > validationResponse = new BaseResult <List <ChannelManagerRequestValidationResponse> >(); // await iConnection.ExecuteStoredProcedure(Constants.StoredProcedure.ValidateAllocationsRequest, paramCollection).ConfigureAwait(false); return(ChannelManagerResponseMapper.MapChannelManagerRequestValidationResponse(validationResponse)); }
public static DynamicParameters CreateUpdateAllocationsValidationRequest(UpdateAllocationsValidationRequest request) { DynamicParameters paramCollection = new DynamicParameters(); paramCollection.Add(Constants.StoredProcedureParameters.HotelCode, request.HotelCode); paramCollection.Add(Constants.StoredProcedureParameters.ChannelManagerId, request.ChannelManagerId); DataTable dataTable = new DataTable("RoomRatePlan"); dataTable.Columns.Add("RoomTypeCode", typeof(string)); dataTable.Columns.Add("RatePlanCode", typeof(string)); foreach (RoomTypeRatePlan roomType in request.RoomTypeRatePlanList) { dataTable.Rows.Add(roomType.RoomTypeCode, roomType.RatePlanCode); } paramCollection.Add(Constants.StoredProcedureParameters.RoomTypeRatePlanList, request.RoomTypeRatePlanList); return(paramCollection); }