private static decimal calculateToppings(OrderDTO order, PizzaPriceDTO prices) { decimal cost = 0.0M; cost += (order.Sausage) ? prices.SausageCost : 0M; cost += (order.Pepperoni) ? prices.PepperoniCost : 0M; cost += (order.Onions) ? prices.OnionCost : 0M; cost += (order.GreenPeppers) ? prices.GreenPeppersCost : 0M; return(cost); }
private static PizzaPriceDTO ConvertToDto(PizzaPrice pizzaPrice) { var dtoPrice = new PizzaPriceDTO(); dtoPrice.SmallSizeCost = pizzaPrice.SmallSizeCost; dtoPrice.MediumSizeCost = pizzaPrice.MediumSizeCost; dtoPrice.LargeSizeCost = pizzaPrice.LargeSizeCost; dtoPrice.RegularCrustCost = pizzaPrice.RegularCrustCost; dtoPrice.ThinCrustCost = pizzaPrice.ThinCrustCost; dtoPrice.ThickCrustCost = pizzaPrice.ThickCrustCost; dtoPrice.PepperoniCost = pizzaPrice.PepperoniCost; dtoPrice.SausageCost = pizzaPrice.SausageCost; dtoPrice.OnionCost = pizzaPrice.OnionCost; dtoPrice.GreenPepperCost = pizzaPrice.GreenPepperCost; return(dtoPrice); }
private static decimal calculateCrustCost(OrderDTO order, PizzaPriceDTO prices) { decimal cost = 0.0M; switch (order.Crust) { case DTO.Enums.CrustType.Regular: cost = prices.RegularCrustCost; break; case DTO.Enums.CrustType.Thin: cost = prices.ThinCrustCost; break; case DTO.Enums.CrustType.Thick: cost = prices.ThickCrustCost; break; default: break; } return(cost); }
private static decimal calculateSizeCost(OrderDTO order, PizzaPriceDTO prices) { decimal cost = 0.0M; switch (order.Size) { case DTO.Enums.SizeType.Small: cost = prices.SmallSizeCost; break; case DTO.Enums.SizeType.Medium: cost = prices.MediumSizeCost; break; case DTO.Enums.SizeType.Large: cost = prices.LargeSizeCost; break; default: break; } return(cost); }