public JsonResult GetCustomerInvoiceDetails(int customerid) { DeliveryDetailRepository repo = new DeliveryDetailRepository(new honeysaleEntities()); //List<DeliveryDetail> delivertdetails = new List<DeliveryDetail>(); //try // { var delivertdetails1 = repo.GetAllDeliveryDetails(). Where(ite => ite.cust_id == customerid) .Select(c => new { InvoiceNo = c.voucherNo, PaidAmount = c.paidAmount, Balance = c.balanceAmount }) .ToList(); // } // catch (Exception) // { // } return(new System.Web.Mvc.JsonResult() { Data = new { result = delivertdetails1 } }); }