Esempio n. 1
0
        public async Task <int> AddOrder(DTO.Order order)
        {
            Models.Order newOrder = OrdersMapper.MapOrderDTO(order);
            ordersDbContext.Order.Add(newOrder);
            await ordersDbContext.SaveChangesAsync();

            return(newOrder.Id);
        }
Esempio n. 2
0
        private async void LoadCustomersOrders()
        {
            try
            {
                if (SelectedCustomer != null)
                {
                    var orders = await _orderRepository.GetOrdersForCustomersAsync(SelectedCustomer.Id);

                    SelectedCustomer.OrdersList = await OrdersMapper.Map(orders);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Esempio n. 3
0
        public void CheckMapper()
        {
            Orders order = new Orders()
            {
                OrderNumber            = 1,
                CustomerName           = "Wise",
                State                  = "OH",
                TaxRate                = 6.25m,
                ProductType            = "Wood",
                Area                   = 100.00m,
                CostPerSquareFoot      = 5.15m,
                LaborCostPerSquareFoot = 4.75m
            };

            string check = "1,Wise,OH,6.25,Wood,100.00,5.15,4.75,515.00,475.00,61.88,1051.88";

            string expected = OrdersMapper.ToStringCSV(order);

            Assert.AreEqual(check, expected);
        }
Esempio n. 4
0
        private async Task LoadOrders()
        {
            try
            {
                IsBusy = true;

                OrdersList = await OrdersMapper.Map(await _repo.GetOrdersAsync());

                OrdersView = CollectionViewSource.GetDefaultView(OrdersList);

                SelectedItemGroup = ItemsGroup[0];
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 5
0
        public async void LoadOrders(DateTime fromDate, DateTime toDate)
        {
            var filteredOrders = await _orderRepository.GetCustomerOrdersPerPeriod(SelectedCustomer.Id, fromDate, toDate);

            SelectedCustomer.OrdersList = await OrdersMapper.Map(filteredOrders);
        }
Esempio n. 6
0
        public async Task <IActionResult> GetOrder([FromRoute] int idOrder)
        {
            var orderDb = await ordersService.GetOrder(idOrder);

            return(Ok(OrdersMapper.MapOrderModel(orderDb)));
        }