Skip to content

Commit fea3b14

Browse files
committed
feat: configura combo para categorias
1 parent a36d120 commit fea3b14

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace BlazingShop.Products.Common;
2+
3+
public sealed class GetCategoriesQuery
4+
{
5+
public int Id { get; }
6+
7+
public string Title { get; } = string.Empty;
8+
}

src/BlazingShop/Products/CreateProduct/CreateProductPage.razor

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@
1818
</div>
1919
</div>
2020
<div class="col-3">
21+
<div class="mb-3">
22+
<label for="category" class="form-label">Category</label>
23+
<InputSelect id="category" class="form-select" aria-label="Select Category"
24+
@bind-Value="_model.CategoryId">
25+
<option value="">Select Category</option>
26+
@foreach (var category in _categories)
27+
{
28+
<option value="@category.Id">@category.Title</option>
29+
}
30+
</InputSelect>
31+
</div>
32+
33+
<div class="mb-3">
34+
<label for="image" class="form-label">Image</label>
35+
<InputFile id="image" class="form-control" @bind-Value="_model.Image" accept=".png,.jpeg" />
36+
</div>
37+
2138
<div class="mb-3">
2239
<label for="price" class="form-label">Price</label>
2340
<InputNumber id="price" class="form-control" @bind-Value="_model.Price" />
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
namespace BlazingShop.Products.CreateProduct;
1+
using BlazingShop.Products.Common;
2+
3+
namespace BlazingShop.Products.CreateProduct;
24

35
public partial class CreateProductPage
46
{
57
private readonly CreateProductInput _model = new();
68

9+
private readonly IEnumerable<GetCategoriesQuery> _categories = [];
10+
711
async Task HandleSubmitAsync() { }
812
}

0 commit comments

Comments
 (0)