public ProductCatGetRes GetProductCategoryByParam([FromBody] ProductCatGetReq request) { var response = new ProductCatGetRes(); try { if (request != null) { var result = _productRepository.GetProductCategoryByParam(request); if (result != null && result.Count > 0) { response.ResponseStatus.Status = "Success"; response.ProdCategoryDetails = result.ToList(); } else { response.ResponseStatus.Status = "Success"; response.ResponseStatus.ErrorMessage = "No Records Found."; } } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "Request Details can not be null/blank."; } } catch (Exception ex) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message; } return(response); }
public async Task <ProductCatGetRes> GetProductCategoryByParam(ProductCatGetReq productCatGetReq, string ticket) { ProductCatGetRes productCatGetRes = new ProductCatGetRes(); productCatGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceMaster:GetProductCategoryByParam"), productCatGetReq, typeof(ProductCatGetRes), ticket); return(productCatGetRes); }
public JsonResult GetProductCategoryByParam(ProductCatGetReq request) { MasterProviders objMasterProviders = new MasterProviders(_configuration); ProductCatGetRes productCatGetRes = objMasterProviders.GetProductCategoryByParam(request, token).Result; if (productCatGetRes.ResponseStatus.Status == "Success" && productCatGetRes.ProdCategoryDetails.Count > 0) { List <AutoCompleteTextBox> catlist = new List <AutoCompleteTextBox>(); catlist = productCatGetRes.ProdCategoryDetails.Select(data => new AutoCompleteTextBox { value = data.ProductCategoryId, label = data.ProductCategoryName }).ToList(); return(Json(catlist)); } else { return(Json("")); } }
public JsonResult GetProductCategory(string ProductId) { MasterProviders objMasterProviders = new MasterProviders(_configuration); ProductCatGetReq objProdCatGetReq = new ProductCatGetReq { ProductId = ProductId }; ProductCatGetRes objMasterTypeResponse = objMasterProviders.GetProductCategoryByParam(objProdCatGetReq, token).Result; if (objMasterTypeResponse.ResponseStatus.Status == "Success" && objMasterTypeResponse.ProdCategoryDetails.Count > 0) { List <AutoCompleteTextBox> CategoryList = new List <AutoCompleteTextBox>(); CategoryList = objMasterTypeResponse.ProdCategoryDetails.Select(data => new AutoCompleteTextBox { value = data.ProductCategoryId, label = data.ProductCategoryName }).ToList(); return(Json(CategoryList)); } else { return(Json("")); } }
public List <BookingPositionViewModel> BindMealList(BookingDetailRes response, BookingSearchRes res, ProductRangeGetRes prodRangeGetRes, ProductCatGetRes prodCatGetRes) { List <BookingPositionViewModel> lstMealposition = new List <BookingPositionViewModel>(); //ProductRangeGetReq prodRangeGetReq = new ProductRangeGetReq(); //ProductRangeGetRes prodRangeGetRes = new ProductRangeGetRes(); //ProductCatGetReq prodCatGetReq = new ProductCatGetReq(); //ProductCatGetRes prodCatGetRes = new ProductCatGetRes(); if (response.Booking.Services != null && res.BookingRooms != null) { var mealpositions = response.Booking.Services.Where(a => a.ProductType.ToUpper() == "MEAL").ToList(); //BookingPositions var positionIds = mealpositions.Select(x => x.Position_Id).ToList(); var rooms = res.BookingRooms.Where(x => positionIds.Contains(x.PositionId) && x.PersonType == "ADULT").Select(y => new { y.ProductRangeId, y.ProductTemplate, y.PositionId }).ToList(); //BookingRooms #region Get Product Range by Product Id list //var productRangeIds = rooms.Select(x => x.ProductRangeId).ToList(); //prodRangeGetReq.ProductRangeIdList = productRangeIds; //prodRangeGetRes = objMasterProviders.GetProductRangeByParam(prodRangeGetReq, token).Result; var lstrange = prodRangeGetRes.ProductRangeDetails.Select(y => new { y.ProductCategoryId, y.ProductMenu, y.VoyagerProductRange_Id }); #endregion #region Get Product Category by Product Category Id list //var productCategoryIds = lstrange.Select(x => x.ProductCategoryId).ToList(); //prodCatGetReq.ProdCatIdList = productCategoryIds; //prodCatGetRes = objMasterProviders.GetProductCategoryByParam(prodCatGetReq, token).Result; var lstCategory = prodCatGetRes.ProdCategoryDetails.Select(y => new { y.ProductCategoryId, y.ProductCategoryName }); #endregion foreach (var meal in mealpositions) { var prodRangeId = rooms.Where(x => x.PositionId == meal.Position_Id).Select(y => y.ProductRangeId).FirstOrDefault() ?? ""; var prodCatId = lstrange.Where(x => x.VoyagerProductRange_Id == prodRangeId).Select(y => y.ProductCategoryId).FirstOrDefault() ?? ""; var pos = new BookingPositionViewModel(); pos.StartDate = meal.StartDate; pos.Country = meal.Country; pos.City = meal.City; pos.ProductName = meal.ProductName; pos.Status = meal.Status; pos.RestaurantType = lstCategory.Where(x => x.ProductCategoryId == prodCatId).Select(y => y.ProductCategoryName).FirstOrDefault() ?? ""; pos.Meal = rooms.Where(x => x.PositionId == meal.Position_Id).Select(y => y.ProductTemplate).FirstOrDefault() ?? ""; pos.Menu = lstrange.Where(x => x.VoyagerProductRange_Id == prodRangeId).Select(y => y.ProductMenu).FirstOrDefault() ?? ""; lstMealposition.Add(pos); } return(lstMealposition); //model.MealPositions = lstMealposition; } else { return(null); //model.MealPositions = new List<BookingPositionViewModel>(); } }