public static Basket ToBasketViewModel(this Models.Basket basket) { return(new Basket { Items = basket.Items.ToBasketItemViewModels(), GrossTotal = basket.GetGrossTotal() }); }
public static Models.Order ToOrderModel(this Models.Basket basket) { return(new Models.Order { ID = Guid.NewGuid(), GrossTotal = basket.GetGrossTotal(), NetTotal = basket.Items.Sum(item => item.NetPrice), TaxTotal = basket.Items.Sum(item => item.NetPrice * item.TaxRate), Items = basket.Items.ToOrderItemModels() }); }