public UserOrderViewModel(IProductRepository productRepository, UserOrderHeaderModel userOrderHeaderModel)
        {
            _productRepository    = productRepository;
            _userOrderHeaderModel = userOrderHeaderModel;


            GetAllProducts();
        }
 private async void _modalService_OnClose(ModalResult result)
 {
     if (!result.Cancelled)
     {
         UserOrderHeaderModel updated = (UserOrderHeaderModel)result.Data;
         _orderRepository.Delete(updated.Id);
         await LoadOrdersList();
     }
     _modalService.OnClose -= _modalService_OnClose;
 }
        public void DeleteOrder(UserOrderHeaderModel userOrderHeaderModel)
        {
            _modalService.OnClose += _modalService_OnClose;
            var parameters = new ModalParameters();

            parameters.Add("order", userOrderHeaderModel);
            var options = new ModalOptions()
            {
                DisableBackgroundCancel = true
            };

            _modalService.Show <DeleteIndyvidualOrderForm>("Czy na pewno chcesz usunąć zamówienie?", parameters, options);
        }
        public UserCartViewModel(UserOrderHeaderModel userOrderHeaderModel
                                 , IOrderRepository orderRepository
                                 , AuthenticationStateProvider authenticationStateProvider
                                 , NavigationManager navigationManager)
        {
            _userOrderHeaderModel        = userOrderHeaderModel;
            _orderRepository             = orderRepository;
            _authenticationStateProvider = authenticationStateProvider;
            _navigationManager           = navigationManager;

            ItemsInCart = new TrulyObservableCollection <UserOrderLineModel>(_userOrderHeaderModel.AvailableItems.Where(x => x.IsInCart == true).ToList());
            RecalculateOrder();
            ItemsInCart.CollectionChanged += ItemsInCart_CollectionChanged;
        }
Exemple #5
0
        private void _modalService_OnClose(ModalResult result)
        {
            if (!result.Cancelled)
            {
                UserOrderHeaderModel updated = (UserOrderHeaderModel)result.Data;

                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <UserOrderLineModel, OrderLineModelDto>();
                    cfg.CreateMap <UserOrderHeaderModel, OrderHeaderModelDto>();
                });
                IMapper iMapper = config.CreateMapper();

                OrderHeaderModelDto modelDto = iMapper.Map <UserOrderHeaderModel, OrderHeaderModelDto>(updated);
                _orderRepository.ChangeOrderStatus(modelDto, StatusEnum.Rejected);
                LoadOrdersList(updated.BuyerId);
            }
            _modalService.OnClose -= _modalService_OnClose;
        }
Exemple #6
0
        public void RejectOrder(SellerOrderHeaderModel sellerOrderHeaderModel)
        {
            _modalService.OnClose += _modalService_OnClose;
            var parameters = new ModalParameters();
            UserOrderHeaderModel userOrderHeaderModel = new UserOrderHeaderModel
            {
                Id = sellerOrderHeaderModel.Id,
                CreationDateFormatted = sellerOrderHeaderModel.CreationDateFormatted,
                SummaryValue          = sellerOrderHeaderModel.SummaryValue,
                BuyerId = sellerOrderHeaderModel.BuyerId
            };

            parameters.Add("order", userOrderHeaderModel);
            var options = new ModalOptions()
            {
                DisableBackgroundCancel = true
            };

            _modalService.Show <DeleteIndyvidualOrderForm>("Czy na pewno musisz odrzucić zamówienie?", parameters, options);
        }
 void ClickDel(UserOrderHeaderModel userOrderHeaderModel)
 {
     _myCurrentOrdersViewModel.DeleteOrder(userOrderHeaderModel);
 }
 protected override void OnInitialized()
 {
     OrderModel = Parameters.Get <UserOrderHeaderModel>("order");
 }