public object addCartReq(loadCartRequest loadCartRequest) { string requestType = "loadCartRequest"; var obj = _routingService.routeAndFetchRepository(loadCartRequest, requestType); return(obj); }
public loadCartResponse getLoadCartSvc(loadCartRequest loadCartRequest) { var result = _liquorDeliveryRepo.getLoadCartRepo(loadCartRequest); return(result as loadCartResponse); }
public object routeAndFetchRepository(object apiRequest, string requestType) { object serviceResponse = null; if (requestType == "userOtpAuth") { userOtpAuthRequest UserOtpAuthRequest = new userOtpAuthRequest(); UserOtpAuthRequest = apiRequest as userOtpAuthRequest; return(serviceResponse = _liquorDeliverySvc.getUserOtpAuthSvc(UserOtpAuthRequest)); } else if (requestType == "userOtpReq") { mobileNumber MobileNumber = new mobileNumber(); MobileNumber = apiRequest as mobileNumber; return(serviceResponse = _liquorDeliverySvc.getUserOtpSvc(MobileNumber)); } else if (requestType == "parentsCategoriesMenuRequest") { parentsCategoriesMenuRequest parentsCategoriesMenuRequest = new parentsCategoriesMenuRequest(); parentsCategoriesMenuRequest = apiRequest as parentsCategoriesMenuRequest; return(serviceResponse = _liquorDeliverySvc.getParentCategoriesMenuSvc(parentsCategoriesMenuRequest)); } else if (requestType == "childSubCategoriesMenuRequest") { childSubCategoriesMenuRequest childSubCategoriesMenuRequest = new childSubCategoriesMenuRequest(); childSubCategoriesMenuRequest = apiRequest as childSubCategoriesMenuRequest; return(serviceResponse = _liquorDeliverySvc.getChildCategoriesMenuSvc(childSubCategoriesMenuRequest)); } else if (requestType == "addCartRequest") { addCartRequest addCartRequest = new addCartRequest(); addCartRequest = apiRequest as addCartRequest; return(serviceResponse = _liquorDeliverySvc.getAddCartSvc(addCartRequest)); } else if (requestType == "loadCartRequest") { loadCartRequest loadCartRequest = new loadCartRequest(); loadCartRequest = apiRequest as loadCartRequest; return(serviceResponse = _liquorDeliverySvc.getLoadCartSvc(loadCartRequest)); } else if (requestType == "notificationRequest") { notificationRequest notificationRequest = new notificationRequest(); notificationRequest = apiRequest as notificationRequest; return(serviceResponse = _liquorDeliverySvc.getCustNotificationSvc(notificationRequest)); } else if (requestType == "customerProfileRequest") { customerProfileRequest customerProfileRequest = new customerProfileRequest(); customerProfileRequest = apiRequest as customerProfileRequest; return(serviceResponse = _liquorDeliverySvc.getCustomerProfileInsertSvc(customerProfileRequest)); } else if (requestType == "customerProfileLoadRequest") { customerProfileLoadRequest customerProfileLoadRequest = new customerProfileLoadRequest(); customerProfileLoadRequest = apiRequest as customerProfileLoadRequest; return(serviceResponse = _liquorDeliverySvc.getCustomerProfileLoadSvc(customerProfileLoadRequest)); } else if (requestType == "notificationUpdateRequestcs") { notificationUpdateRequest notificationUpdateRequest = new notificationUpdateRequest(); notificationUpdateRequest = apiRequest as notificationUpdateRequest; return(serviceResponse = _liquorDeliverySvc.getUpdateNotificationSvc(notificationUpdateRequest)); } else if (requestType == "bookingRequest") { bookingRequest bookingRequest = new bookingRequest(); bookingRequest = apiRequest as bookingRequest; return(serviceResponse = _liquorDeliverySvc.getCustomerBookingSvc(bookingRequest)); } return(serviceResponse); }
public loadCartResponse getLoadCartRepo(loadCartRequest loadCartRequest) { string connectionString = getConnectionName("localDBConnection"); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); var loadCart = connection.QueryMultiple("[dbo].use_sp_load_cart", new { loadCartRequest.mobileNo, loadCartRequest.sessionToken }, commandType: CommandType.StoredProcedure); var result = loadCart.ReadSingleOrDefault <resultmodel>(); if (result != null) { if (result.Result == "1") { var cartCount = loadCart.ReadSingle <cartCountValue>(); var loadCartInfo = loadCart.Read <CartInfo>().ToList(); var otherCharges = loadCart.Read <otherCharges>(); var otherChargesArray = otherCharges.ToArray(); var finResult = new loadCartResponse() { CartDetails = loadCartInfo.ToList(), ResponseCode = "1", CartCount = cartCount.CartCount, DeliveryCharge = otherChargesArray[0].DeliveryCharge, TaxPer = otherChargesArray[0].TaxPer, ExtraCharge = otherChargesArray[0].ExtraCharge }; return(finResult); } else if (result.Result == "0") { return(new loadCartResponse() { CartDetails = null, ResponseCode = "0", CartCount = null, DeliveryCharge = null, TaxPer = null, ExtraCharge = null }); } else if (result.Result == "2") { return(new loadCartResponse() { CartDetails = null, ResponseCode = "2", CartCount = null, DeliveryCharge = null, TaxPer = null, ExtraCharge = null }); } else if (result.Result == "8") { return(new loadCartResponse() { CartDetails = null, ResponseCode = "8", CartCount = null, DeliveryCharge = null, TaxPer = null, ExtraCharge = null }); } else { return(new loadCartResponse() { CartDetails = null, ResponseCode = "0", CartCount = null, DeliveryCharge = null, TaxPer = null, ExtraCharge = null }); } } else { return(new loadCartResponse() { CartDetails = null, ResponseCode = "0", CartCount = null, DeliveryCharge = null, TaxPer = null, ExtraCharge = null }); } } }