public JsonResult _ProductPriceDetail() { int check; if (!string.IsNullOrEmpty(Request.Params["ProductId"]) && string.IsNullOrEmpty(Request.Params["AccountId"])) { var prodId = (int.Parse(Request.Params["ProductId"])); var products = _productServices.GetProductMasterById(prodId); var prices = new { Price = 0, products.ProcessByCase, products.ProcessByPallet, products.CasesPerPallet, products.ProductsPerCase, products.AllowModifyPrice, products.AllowZeroSale, ProductsPerPallet = products.CasesPerPallet * products.ProductsPerCase }; return(Json(prices, JsonRequestBehavior.AllowGet)); } if (string.IsNullOrEmpty(Request.Params["ProductId"]) || string.IsNullOrEmpty(Request.Params["AccountId"])) { return(Json(new { Price = 0 }, JsonRequestBehavior.AllowGet)); } if (!int.TryParse(Request.Params["ProductId"].ToString(), out check)) { return(Json(new { Price = 0 }, JsonRequestBehavior.AllowGet)); } var productId = (int.Parse(Request.Params["ProductId"])); var accountId = (int.Parse(Request.Params["AccountId"])); var product = _productServices.GetProductMasterById(productId); var price = new { Price = Request.UrlReferrer.AbsoluteUri.Contains("PurchaseOrder") ? _productPriceService.GetLastPurchaseProductPriceForAccount(productId, accountId) : _productPriceService.GetLastSoldProductPriceForAccount(productId, accountId), product.ProcessByCase, product.ProcessByPallet, product.CasesPerPallet, product.ProductsPerCase, product.AllowModifyPrice, product.AllowZeroSale, ProductsPerPallet = product.CasesPerPallet * product.ProductsPerCase }; return(Json(price, JsonRequestBehavior.AllowGet)); }