コード例 #1
0
ファイル: ShoppingList.cs プロジェクト: MiBuena/BlazorProject
        private async Task ReplenishAllItems()
        {
            var replenishmentModel = ReplenishmentBuilder.BuildReplenishmentDto(this.FirstReplenishmentDate, this.SecondReplenishmentDate, this.ReplenishmentItems);

            await this.ReplenishmentService.ReplenishItems(replenishmentModel);

            NavigateToAllItems();
        }
コード例 #2
0
ファイル: ShoppingList.cs プロジェクト: MiBuena/BlazorProject
        private async Task ReplenishItem(int itemId)
        {
            var viewModel          = this.ReplenishmentItems.FirstOrDefault(x => x.ItemId == itemId);
            var replenishmentModel = ReplenishmentBuilder.BuildReplenishmentDto(this.FirstReplenishmentDate, this.SecondReplenishmentDate, viewModel);

            await this.ReplenishmentService.ReplenishItems(replenishmentModel);

            var response = await ReplenishmentService.GetShoppingListItems(this.FirstReplenishmentDate, this.SecondReplenishmentDate);

            if (!response.IsSuccess)
            {
                this.Error.Show(response.ErrorMessage);
            }

            if (response.Data != null)
            {
                this.ReplenishmentItems = response.Data.Select(x => Mapper.Map <ReplenishmentItemDto, PurchaseItemViewModel>(x)).ToList();
            }
        }