35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using StopShopping.Services;
|
|
using StopShopping.Services.Models.Req;
|
|
using StopShopping.Services.Models.Resp;
|
|
|
|
namespace StopShopping.AdminApi.Routes;
|
|
|
|
public static class District
|
|
{
|
|
public static RouteGroupBuilder MapDistrict(this RouteGroupBuilder routes)
|
|
{
|
|
routes.MapGet("/district/top3level", GetTop3LevelDistrictsAsync)
|
|
.WithTags(OpenApiTags.地址.ToString());
|
|
|
|
routes.MapGet("/district/children", GetChildrenDistricts)
|
|
.WithTags(OpenApiTags.地址.ToString());
|
|
|
|
return routes;
|
|
}
|
|
|
|
private static ApiResponse<List<Services.Models.Resp.District>> GetChildrenDistricts(
|
|
[AsParameters] DistrictParentIdParams model,
|
|
IDistrictService districtService
|
|
)
|
|
{
|
|
return districtService.GetChildren(model);
|
|
}
|
|
|
|
private static async Task<ApiResponse<List<Services.Models.Resp.District>>> GetTop3LevelDistrictsAsync(
|
|
IDistrictService districtService
|
|
)
|
|
{
|
|
return await districtService.GetTop3LevelDistrictsAsync();
|
|
}
|
|
}
|