private void InitializeStoresList()
        {
            var storesService = new StoresService(ConfigurationManager.AppSettings["ApiUrl"]);
            var stores        = storesService.GetStores();

            StoresDropdown.ItemsSource = stores;
        }
示例#2
0
 public RecipeDetailsController(RecipeDetailsService recipeDetailsService, IngredientService ingredientService,
                                UnitsService unitsService, StoresService storesService)
 {
     _recipeDetailsService = recipeDetailsService;
     _ingredientService    = ingredientService;
     _unitsService         = unitsService;
     _storesService        = storesService;
 }
        /// <summary>Creates new customer order and show response.</summary>
        /// <param name="customerOrderService">The customer order service.</param>
        /// <param name="customer">The customer.</param>
        private static void CreateNewCustomerOrderAndShowResponse(CustomerOrderService customerOrderService, Customer customer)
        {
            Console.WriteLine("Getting all items.");

            ItemService itemService = new ItemService();

            List <Item> items = itemService.GetAll();

            Console.WriteLine("Getting all stores.");

            StoresService storesService = new StoresService();

            List <Store> stores = storesService.GetAll();

            NewCustomerOrder newOrder = NewCustomerOrderBuilder.Build($"{Constants.APP_NAME}{CurrentTimeAsString}",
                                                                      customer,
                                                                      stores.FirstOrDefault().StoreClientCode,
                                                                      "API CSharp Order Comment");

            newOrder.Items.Add(new CustomerOrderItem()
            {
                Code      = items.Last().ItemLookupCode,
                Quantity  = 2,
                UnitPrice = 9.99,
            });

            try
            {
                Console.WriteLine("Creating an order.");

                int orderId = customerOrderService.Create(newOrder);

                Console.WriteLine($"New Order Id : {orderId}");
            }
            catch (Exception exception)
            {
                Console.WriteLine($"New Order Failed - {exception.Message}");
            }
        }
 public StoresController(StoresService storesService)
 {
     _storesService = storesService;
 }
 public StoresController(StoresService service)
 {
     this.service = service;
 }
 public IngredientsController(IngredientService ingredientService, StoresService storesService)
 {
     _ingredientService = ingredientService;
     _storesService     = storesService;
 }