Hello Team,
I have two form view, the Outer layer consist of SupplierId, Supplier name, Purchase date,Amount, Discount,GrandTotal,IsPaid, detail button and, delete button, so the logic is that when I click detail button on form View one then it will open form view two which contain the product details.
In my angular Js controller contain the dataTable of the Form View one and JS Controller is not able to filter the record based on the supplierId when I click on Detail button which needs to open form view two for me.

I want to filter the data base on supplliers.

FORM VIEW TWO BELOW, it load all the data from the database and not by supplierId

My first method load all the data into the Form two View without filltering and the second method give this generic error;
and when I implement the second method then this error popup;
DataTables warning: table id=PurchaseDataTable - Ajax error. For more information about this error, please see
First Method that load all the data is;
public ActionResult GetAllPurchases()
{
try
{
var purchases = objRestaurantDBEntities.tblPurchases
.Select(x => new PurchasesViewModel
{
PurchaseID = x.PurchaseID,
StockInDate = x.StockInDate,
SupplierId = x.SupplierId,
Name = x.tblSupply.Name,
Total = x.Total,
Discount = x.Discount,
Tax = x.Tax,
GrandTotal = x.GrandTotal,
IsPaid = x.IsPaid,
Description = x.Description
})
.ToList();
return Json(purchases, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new { error = ex.Message }, JsonRequestBehavior.AllowGet);
}
}