Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints
|
||||
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints;
|
||||
|
||||
public class CatalogBrandDto
|
||||
{
|
||||
public class CatalogBrandDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints
|
||||
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints;
|
||||
|
||||
public class ListCatalogBrandsResponse : BaseResponse
|
||||
{
|
||||
public class ListCatalogBrandsResponse : BaseResponse
|
||||
public ListCatalogBrandsResponse(Guid correlationId) : base(correlationId)
|
||||
{
|
||||
public ListCatalogBrandsResponse(Guid correlationId) : base(correlationId)
|
||||
{
|
||||
}
|
||||
|
||||
public ListCatalogBrandsResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public List<CatalogBrandDto> CatalogBrands { get; set; } = new List<CatalogBrandDto>();
|
||||
}
|
||||
|
||||
public ListCatalogBrandsResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public List<CatalogBrandDto> CatalogBrands { get; set; } = new List<CatalogBrandDto>();
|
||||
}
|
||||
|
||||
@@ -1,45 +1,44 @@
|
||||
using Ardalis.ApiEndpoints;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.ApiEndpoints;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints
|
||||
namespace Microsoft.eShopWeb.PublicApi.CatalogBrandEndpoints;
|
||||
|
||||
public class List : BaseAsyncEndpoint
|
||||
.WithoutRequest
|
||||
.WithResponse<ListCatalogBrandsResponse>
|
||||
{
|
||||
public class List : BaseAsyncEndpoint
|
||||
.WithoutRequest
|
||||
.WithResponse<ListCatalogBrandsResponse>
|
||||
private readonly IRepository<CatalogBrand> _catalogBrandRepository;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public List(IRepository<CatalogBrand> catalogBrandRepository,
|
||||
IMapper mapper)
|
||||
{
|
||||
private readonly IRepository<CatalogBrand> _catalogBrandRepository;
|
||||
private readonly IMapper _mapper;
|
||||
_catalogBrandRepository = catalogBrandRepository;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
public List(IRepository<CatalogBrand> catalogBrandRepository,
|
||||
IMapper mapper)
|
||||
{
|
||||
_catalogBrandRepository = catalogBrandRepository;
|
||||
_mapper = mapper;
|
||||
}
|
||||
[HttpGet("api/catalog-brands")]
|
||||
[SwaggerOperation(
|
||||
Summary = "List Catalog Brands",
|
||||
Description = "List Catalog Brands",
|
||||
OperationId = "catalog-brands.List",
|
||||
Tags = new[] { "CatalogBrandEndpoints" })
|
||||
]
|
||||
public override async Task<ActionResult<ListCatalogBrandsResponse>> HandleAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var response = new ListCatalogBrandsResponse();
|
||||
|
||||
[HttpGet("api/catalog-brands")]
|
||||
[SwaggerOperation(
|
||||
Summary = "List Catalog Brands",
|
||||
Description = "List Catalog Brands",
|
||||
OperationId = "catalog-brands.List",
|
||||
Tags = new[] { "CatalogBrandEndpoints" })
|
||||
]
|
||||
public override async Task<ActionResult<ListCatalogBrandsResponse>> HandleAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var response = new ListCatalogBrandsResponse();
|
||||
var items = await _catalogBrandRepository.ListAsync(cancellationToken);
|
||||
|
||||
var items = await _catalogBrandRepository.ListAsync(cancellationToken);
|
||||
response.CatalogBrands.AddRange(items.Select(_mapper.Map<CatalogBrandDto>));
|
||||
|
||||
response.CatalogBrands.AddRange(items.Select(_mapper.Map<CatalogBrandDto>));
|
||||
|
||||
return Ok(response);
|
||||
}
|
||||
return Ok(response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user