File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 11namespace BlazingShop . Products . Common ;
22
3- public sealed class GetCategoriesQuery
4- {
5- public int Id { get ; }
6-
7- public string Title { get ; } = string . Empty ;
8- }
3+ public sealed record GetCategoriesQuery ( int Id , string Title ) ;
Original file line number Diff line number Diff line change 1- using BlazingShop . Products . Common ;
1+ using BlazingShop . Data ;
2+ using BlazingShop . Products . Common ;
3+ using Microsoft . EntityFrameworkCore ;
24
35namespace BlazingShop . Products . CreateProduct ;
46
5- public partial class CreateProductPage
7+ public partial class CreateProductPage ( AppDbContext context )
68{
79 private readonly CreateProductInput _model = new ( ) ;
810
9- private readonly IEnumerable < GetCategoriesQuery > _categories = [ ] ;
11+ private IEnumerable < GetCategoriesQuery > _categories = [ ] ;
12+
13+ protected override async Task OnInitializedAsync ( )
14+ {
15+ _categories = await context . Categories . AsNoTracking ( )
16+ . Select ( c => new GetCategoriesQuery ( c . Id , c . Title ) )
17+ . ToListAsync ( ) ;
18+ }
1019
1120 async Task HandleSubmitAsync ( ) { }
1221}
You can’t perform that action at this time.
0 commit comments