Exemple #1
0
        public async Task <ThumbnailDto> GetThumbnail([FromRoute] string thumbnail)
        {
            var b64 = await CategoryAppService.GetThumbnail(thumbnail);

            return(new ThumbnailDto {
                Base64DataUrl = b64
            });
        }
Exemple #2
0
        public async Task <CategoryDto[]> GetAll()
        {
            await CustomerAppService.GetAllAddressDtoAsync();

            var categories = await CategoryAppService.GetAllAsync();

            return(categories.ToArray());
        }
Exemple #3
0
        private async Task LoadCategoriesAsync()
        {
            var result = await CategoryAppService.GetListAsync(new PagedAndSortedResultRequestDto()
            {
                MaxResultCount = 1000
            });

            CategoryList = result.Items;
        }
        private async Task UpdateCategoryAsync()
        {
            if (EditValidationsRef.ValidateAll())
            {
                await CategoryAppService.UpdateAsync(EditingCategoryId, EditingCategory);
                await GetCategorysAsync();

                EditCategoryModal.Hide();
            }
        }
        private async Task CreateCategoryAsync()
        {
            if (CreateValidationsRef.ValidateAll())
            {
                await CategoryAppService.CreateAsync(NewCategory);
                await GetCategorysAsync();

                CreateCategoryModal.Hide();
            }
        }
        private async Task DeleteCategoryAsync(CategoryDto Category)
        {
            var confirmMessage = L["CategoryDeletionConfirmationMessage", Category.Name];

            if (!await Message.Confirm(confirmMessage))
            {
                return;
            }

            await CategoryAppService.DeleteAsync(Category.Id);

            await GetCategorysAsync();
        }
        private async Task GetCategorysAsync()
        {
            var result = await CategoryAppService.GetListAsync(
                new GetCategoryListDto
            {
                MaxResultCount = PageSize,
                SkipCount      = CurrentPage * PageSize,
                Sorting        = CurrentSorting
            }
                );

            CategoryList = result.Items;
            TotalCount   = (int)result.TotalCount;
        }
        public async Task Should_Able_To_Create_A_Category()
        {
            var categoryCreateDto = new CategoryCreateDto
            {
                CategoryName        = "Corn bread yummy",
                CategoryDescription = "Corn break from sri lankan farms",
                ThumbnailBase64     = Convert.ToBase64String(TestDataProvider.GetPicture())
            };

            var categoryDto = await CategoryAppService.CreateAsync(categoryCreateDto);

            categoryDto.ShouldNotBeNull();

            categoryDto.Id.ShouldBeGreaterThan(0);
            categoryDto.CategoryName.ShouldBe(categoryCreateDto.CategoryName);
            categoryDto.CategoryDescription.ShouldBe(categoryCreateDto.CategoryDescription);
            categoryDto.CategoryThumbnail.ShouldNotBeNullOrEmpty();
            categoryDto.CategoryThumbnail.ShouldNotBeNullOrWhiteSpace();
        }
Exemple #9
0
        public async Task Delete([FromRoute] int id)

        {
            await CategoryAppService.DeleteAsync(id);
        }
Exemple #10
0
 public async Task <CategoryDto> Update(
     [FromRoute] int id,
     [FromBody] CategoryUpdateDto dto)
 {
     return(await CategoryAppService.UpdateAsync(id, dto));
 }
Exemple #11
0
 public async Task <CategoryDto> Create([FromBody] CategoryCreateDto dto)
 {
     return(await CategoryAppService.CreateAsync(dto));
 }
Exemple #12
0
 public async Task <CategoryDto> Get([FromRoute] int id)
 {
     return(await CategoryAppService.GetAsync(id));
 }
 public CategoryController(CategoryAppService categoryAppService)
 {
     _categoryAppService = categoryAppService;
 }
Exemple #14
0
 public ProductsController(IProductAppService productAppService, CategoryAppService categoryAppService)
 {
     _productAppService  = productAppService;
     _categoryAppService = categoryAppService;
 }