public double GetTotalInAOrder(Order order) { var orderDetails = context.OrderDetails.ToList().FindAll(el => el.OrderId == order.Id); double total = new double(); foreach (var item in orderDetails) { var product = context.Products.FirstOrDefault(el => el.Id == item.ProductId); total += detailRepository.CalculateMoney(product.PricePerUnit, item.Discount, item.Quantity); } return(total); }
public JsonResult GetPrice(int ProductId, int Discount, int Quantity) { Product product = detailRepository.GetProductById(ProductId); return(Json(detailRepository.CalculateMoney(product.PricePerUnit, Discount, Quantity))); }