as is
This commit is contained in:
61
StopShopping.AdminApi/Routes/Product.cs
Normal file
61
StopShopping.AdminApi/Routes/Product.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using StopShopping.Services;
|
||||
using StopShopping.Services.Models.Req;
|
||||
using StopShopping.Services.Models.Resp;
|
||||
|
||||
namespace StopShopping.AdminApi.Routes;
|
||||
|
||||
/// <summary>
|
||||
/// 商品相关路由
|
||||
/// </summary>
|
||||
public static class Product
|
||||
{
|
||||
public static RouteGroupBuilder MapProduct(this RouteGroupBuilder routes)
|
||||
{
|
||||
routes.MapGet("/product/list", SearchProductsAsync)
|
||||
.WithTags(OpenApiTags.商品.ToString());
|
||||
|
||||
routes.MapGet("/product/detail", Detail)
|
||||
.WithTags(OpenApiTags.商品.ToString());
|
||||
|
||||
routes.MapPost("/product/edit", EditAsync)
|
||||
.WithTags(OpenApiTags.商品.ToString());
|
||||
|
||||
routes.MapPost("/product/delete", DeleteAsync)
|
||||
.WithTags(OpenApiTags.商品.ToString());
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
private static async
|
||||
Task<ApiResponse<PagedResult<Services.Models.Resp.Product>>>
|
||||
SearchProductsAsync(
|
||||
[AsParameters] ProductSearchParms model,
|
||||
IProductService productService
|
||||
)
|
||||
{
|
||||
return await productService.SearchAsync(model);
|
||||
}
|
||||
|
||||
private static ApiResponse<ProductInfo> Detail(
|
||||
[AsParameters] ProductIdParams model,
|
||||
IProductService productService)
|
||||
{
|
||||
return productService.Detail(model);
|
||||
}
|
||||
|
||||
private static async Task<ApiResponse> EditAsync(
|
||||
EditProductParams model,
|
||||
IProductService productService
|
||||
)
|
||||
{
|
||||
return await productService.EditAsync(model);
|
||||
}
|
||||
|
||||
private static async Task<ApiResponse> DeleteAsync(
|
||||
ProductIdParams model,
|
||||
IProductService productService
|
||||
)
|
||||
{
|
||||
return await productService.DeleteAsync(model);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user