Example #1
0
        public async Task DeleteAsync()
        {
            //Given
            var categories = (await categoryAppService.GetListAsync(new PagedAndSortedResultRequestDto())).Items;
            var category   = categories[0];
            //When
            await categoryAppService.DeleteAsync(category.Id);

            var results = (await categoryAppService.GetListAsync(new PagedAndSortedResultRequestDto())).Items;

            //Then
            results.ShouldNotContain(category);
        }
Example #2
0
        public async Task <ActionResult> Delete(Guid id)
        {
            try
            {
                var response = await _service.DeleteAsync(id);

                if (!response.Success)
                {
                    return(BadRequest(response.Erros));
                }

                return(Ok());
            }
            catch (ArgumentNullException ex)
            {
                return(NotFound("Category does not exist"));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Example #3
0
 public Task DeleteAsync(Guid id)
 {
     return(_service.DeleteAsync(id));
 }
Example #4
0
 public Task DeleteAsync(Guid id)
 {
     return(_categoryAppService.DeleteAsync(id));
 }