public ProductAnalysis HighestSellingProduct() { int high = 0; ProductAnalysis pa = new ProductAnalysis(); foreach (var prod in db.ProductAnalysis.ToList()) { if (prod.Product_Quantity > high) { high = prod.Product_Quantity; pa = prod; } } return(pa); }
public ProductAnalysis LowestSellingProduct() { int low = HighestSellingProduct().Product_Quantity; ProductAnalysis pa = new ProductAnalysis(); foreach (var prod in db.ProductAnalysis.ToList()) { if (prod.Product_Quantity < low) { low = prod.Product_Quantity; pa = prod; } } return(pa); }