public async Task <int> AddOrder(DTO.Order order) { Models.Order newOrder = OrdersMapper.MapOrderDTO(order); ordersDbContext.Order.Add(newOrder); await ordersDbContext.SaveChangesAsync(); return(newOrder.Id); }
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); } }
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); }
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; } }
public async void LoadOrders(DateTime fromDate, DateTime toDate) { var filteredOrders = await _orderRepository.GetCustomerOrdersPerPeriod(SelectedCustomer.Id, fromDate, toDate); SelectedCustomer.OrdersList = await OrdersMapper.Map(filteredOrders); }
public async Task <IActionResult> GetOrder([FromRoute] int idOrder) { var orderDb = await ordersService.GetOrder(idOrder); return(Ok(OrdersMapper.MapOrderModel(orderDb))); }