private ShoppingCart ProcessShoppingCart(GenericProduct product, ShoppingCart shoppingCart) { defaultConsole.WriteLine(Messages.EnterQuantity); while (true) { var quantityInput = Console.ReadLine(); if (Validate(quantityInput)) { var shoppingCartItem = MapUserInputToDomain(product, quantityInput); shoppingCart = this.shoppingCartTasks.AddToShoppingCart(shoppingCartItem); DisplayCartInformation(shoppingCart); break; } } return shoppingCart; }
/// <summary> /// Removes the specified entity. /// </summary> /// <param name="entity">The entity.</param> public void Remove(GenericProduct entity) { var products = new List<GenericProduct>(); products.Remove(entity); }
/// <summary> /// Maps the user input to domain. /// </summary> /// <param name="product">The product.</param> /// <param name="quantityInput">The quantity input.</param> /// <returns>Shopping cart item.</returns> ////NOTE: THIS IS THE FUNCTIONALITY OF AUTOMAPPER TO MAP TO THE VIEWMODEL. public Item MapUserInputToDomain(GenericProduct product, string quantityInput) { var shoppingCartItem = new Item {Product = product, Quantity = Convert.ToInt32(quantityInput)}; return shoppingCartItem; }
/// <summary> /// Adds the specified entity. /// </summary> /// <param name="entity">The entity.</param> public void Add(GenericProduct entity) { new List<GenericProduct> { entity }; }