コード例 #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);
        }
コード例 #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);
            }
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: tubthoj89/Personal-Projects
        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);
        }
コード例 #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;
            }
        }
コード例 #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);
        }
コード例 #6
0
ファイル: OrdersController.cs プロジェクト: RetiSpA/FOK
        public async Task <IActionResult> GetOrder([FromRoute] int idOrder)
        {
            var orderDb = await ordersService.GetOrder(idOrder);

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