public JsonResult GetProducts(Productsearch Productsearch) { var custData = objData.GetProducts(Productsearch); return(new JsonResult { Data = custData, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public List <dynamic> GetProducts(Productsearch Productsearch) { string wherecondition = string.Empty, strCustomerID = string.Empty, strCatID = string.Empty; string strFinalStatus = string.Empty; List <dynamic> objDynamic = new List <dynamic>(); if (!string.IsNullOrEmpty(Productsearch.CustID)) { strCustomerID = "pcr.CustId = " + Productsearch.CustID; } if (!string.IsNullOrEmpty(Productsearch.CatID)) { strCatID = "pcr.ProdCatId = " + Productsearch.CatID; } if (!string.IsNullOrEmpty(strCatID)) { //wherecondition = " AND " + strCatID; wherecondition = " " + strCatID; } if (!string.IsNullOrEmpty(wherecondition)) { if (!string.IsNullOrEmpty(strCustomerID)) { wherecondition = wherecondition + " AND " + strCustomerID; //wherecondition = " " + strCustomerID; } } else { if (!string.IsNullOrEmpty(strCustomerID)) { // wherecondition = wherecondition + " AND " + strCustomerID; wherecondition = " " + strCustomerID; } } if (string.IsNullOrEmpty(wherecondition)) { return(custRequestData.GetProducts(0, 0, 3, wherecondition)); } else { return(custRequestData.GetProducts(0, 0, 2, wherecondition)); } }