public JsonResult Details(int id) { _aSalesView.SalesProductInfos = _salesManager.Details(id); //PurchaseView aPurchaseView = new PurchaseView(); //aPurchaseView.PurchaseInfos = _PurchaseManager.Show(); //List<PurchaseProductInfo> query = new List<PurchaseProductInfo>(); //query = foreach (var product in _aSalesView.SalesProductInfos) { var name = _productManager.GetById(product.ProductId); _aSalesView.ProductName.Add(name.Name); _aSalesView.ProductCode.Add(name.Code); var totalPrice = product.Quantity * product.MRP; _aSalesView.TotalPrices.Add(totalPrice.ToString()); } var x = _aSalesView; return(Json(x, JsonRequestBehavior.AllowGet)); }