public ProductPrice GetProductPrice(DateTime date) { return(ProductPrices .Where(pp => pp.Date <= date) .OrderBy(pp => pp.Date) .LastOrDefault()); }
public decimal GetProductProfit(DateTime date) { var p = ProductPrices .Where(pp => pp.Date <= date) .OrderBy(pp => pp.Date) .LastOrDefault(); return(p.SellingPrice - p.PurchasePrice); }
private decimal PriceOf(RentedProduct rentedProduct) { return(ProductPrices.Where(price => price.ProductId == rentedProduct.ProductId) .Single().UnitRentPrice.Value); }