/// <summary> /// Method to calculate the price of the given item using the given ipl /// </summary> /// <param name="iqp"></param> /// <param name="ipl"></param> /// <returns></returns> private double CalculatePrice(ItemQuantityPairModel iqp, ItemPriceLocationModel ipl) { if (iqp.Measure == ipl.Measure) { var baseRate = ipl.Price / ipl.Quantity; return(iqp.Quantity * baseRate); } switch (iqp.Measure.ToLower()) { case "loaf": return(ipl.Price); case "loaves": return(iqp.Quantity * ipl.Price); default: break; } // TODO if measure is not the same return(ipl.Price); }
/// <inheritdoc /> /// <summary> /// Constructor /// </summary> /// <param name="ipl"></param> public ItemPriceLocationEventArgs(ItemPriceLocationModel ipl) { ItemPriceLocationModel = ipl; }