forked from sanchezvem/PyroFetes
suppr all 'var' and Models.xxx. And added 's' at the end of all directories endpoints
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Endpoints.Product;
|
||||
namespace PyroFetes.Endpoints.Products;
|
||||
|
||||
public class GetAllProductsEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest<List<GetProductDto>>
|
||||
{
|
||||
@@ -14,7 +14,7 @@ public class GetAllProductsEndpoint(PyroFetesDbContext database) : EndpointWitho
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
{
|
||||
var product = await database.Products
|
||||
List<GetProductDto> product = await database.Products
|
||||
.Select(product => new GetProductDto()
|
||||
{
|
||||
Id = product.Id,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using FastEndpoints;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Endpoints.Product;
|
||||
namespace PyroFetes.Endpoints.Products;
|
||||
|
||||
public class GetProductRequest
|
||||
{
|
||||
@@ -19,7 +19,7 @@ public class GetProductEndpoint(PyroFetesDbContext database) : Endpoint<GetProdu
|
||||
|
||||
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
|
||||
{
|
||||
var product = await database.Products
|
||||
Product? product = await database.Products
|
||||
.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
||||
|
||||
if (product == null)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Product.Request;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using PyroFetes.DTO.PurchaseProduct.Response;
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Endpoints.Product;
|
||||
namespace PyroFetes.Endpoints.Products;
|
||||
|
||||
public class PatchProductMinimalStockEndpoint(PyroFetesDbContext database)
|
||||
: Endpoint<PatchProductMinimalStockDto, GetProductDto>
|
||||
@@ -17,7 +17,7 @@ public class PatchProductMinimalStockEndpoint(PyroFetesDbContext database)
|
||||
|
||||
public override async Task HandleAsync(PatchProductMinimalStockDto req, CancellationToken ct)
|
||||
{
|
||||
var product = await database.Products.SingleOrDefaultAsync(po => po.Id == req.Id, ct);
|
||||
Product? product = await database.Products.SingleOrDefaultAsync(po => po.Id == req.Id, ct);
|
||||
if (product == null)
|
||||
{
|
||||
await Send.NotFoundAsync(ct);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PyroFetes.DTO.Product.Request;
|
||||
using PyroFetes.DTO.Product.Response;
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Endpoints.Product;
|
||||
namespace PyroFetes.Endpoints.Products;
|
||||
|
||||
public class UpdateProductEndpoint(PyroFetesDbContext database) : Endpoint<UpdateProductDto, GetProductDto>
|
||||
{
|
||||
@@ -14,7 +15,7 @@ public class UpdateProductEndpoint(PyroFetesDbContext database) : Endpoint<Updat
|
||||
|
||||
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)
|
||||
{
|
||||
var product = await database.Products.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
||||
Product? product = await database.Products.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
||||
|
||||
if (product == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user