3
3
using Microsoft . AspNetCore . Http ;
4
4
using Microsoft . AspNetCore . Mvc ;
5
5
using Supermarket . Core . Models ;
6
- using Supermarket . Domain . Services . Contracts ;
6
+ using Supermarket . Core . Repositories . Contracts ;
7
7
using Supermarket . Resources ;
8
+ using Supermarket . V1 . Dtos . ProductDtos ;
8
9
using System . Collections . Generic ;
9
10
using System . Threading . Tasks ;
10
11
@@ -16,24 +17,24 @@ namespace Supermarket.V1.Controllers
16
17
[ ApiController ]
17
18
public class ProductsController : ControllerBase
18
19
{
19
- private readonly IServiceWrapper _serviceWrapper ;
20
+ private readonly IRepositoryWrapper _repositoryWrapper ;
20
21
private readonly IMapper _mapper ;
21
22
22
- public ProductsController ( IServiceWrapper serviceWrapper , IMapper mapper )
23
+ public ProductsController ( IRepositoryWrapper repositoryWrapper , IMapper mapper )
23
24
{
24
- _serviceWrapper = serviceWrapper ;
25
+ _repositoryWrapper = repositoryWrapper ;
25
26
_mapper = mapper ;
26
27
}
27
28
28
29
[ HttpGet ]
29
30
[ ProducesResponseType ( StatusCodes . Status200OK ) ]
30
31
public async Task < IActionResult > GetAllAsync ( )
31
32
{
32
- var products = await _serviceWrapper . Product . ListAsync ( ) ;
33
+ var products = await _repositoryWrapper . Product . ListAllProductsAsync ( ) ;
33
34
34
- var resources = _mapper . Map < IEnumerable < Product > , IEnumerable < ProductResource > > ( products ) ;
35
+ var productDtos = _mapper . Map < IEnumerable < Product > , IEnumerable < ProductDto > > ( products ) ;
35
36
36
- return Ok ( resources ) ;
37
+ return Ok ( productDtos ) ;
37
38
}
38
39
}
39
40
}
0 commit comments