Exemplo n.º 1
0
 public CachedCatalogItemServiceDecorator(ILocalStorageService localStorageService,
                                          CatalogItemService catalogItemService,
                                          ILogger <CachedCatalogItemServiceDecorator> logger)
 {
     _localStorageService = localStorageService;
     _catalogItemService  = catalogItemService;
     _logger = logger;
 }
Exemplo n.º 2
0
 public CatalogItemServiceTestSuite()
 {
     CatalogItemRepositoryMock = new Mock <ICatalogItemRepository>();
     CatalogServiceMock        = new Mock <ICatalogService>();
     CatalogItemService        = new CatalogItemService(
         CatalogItemRepositoryMock.Object,
         CatalogServiceMock.Object);
 }
Exemplo n.º 3
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                catalogItems = await CatalogItemService.List();

                catalogTypes = await CatalogTypeService.List();

                catalogBrands = await CatalogBrandService.List();

                CallRequestRefresh();
            }

            await base.OnAfterRenderAsync(firstRender);
        }
Exemplo n.º 4
0
        private async Task VerifyCatalogItem(CatalogItemKind validCatalogItemKind, int catalogItemId)
        {
            var catalogItem = await CatalogItemService.Get(catalogItemId);

            if (catalogItem == null)
            {
                throw new EntityNotFoundException(
                          $"CatalogItemId:{catalogItemId} doesn't exist",
                          nameof(catalogItemId));
            }

            if (!catalogItem.Kind.Equals(validCatalogItemKind))
            {
                throw new ArgumentException(
                          $"CatalogItem can't be set because it has a different kind. Necessary kind:{validCatalogItemKind}, catalog item kind:{catalogItem.Kind}");
            }
        }
Exemplo n.º 5
0
        private async Task ReloadCatalogItems()
        {
            catalogItems = await CatalogItemService.List();

            StateHasChanged();
        }