Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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(""));
            }
        }