Untitled

 avatar
unknown
plain_text
2 years ago
430 B
6
Indexable
app.MapGet("/api/products", (IMapper _mapper) =>   // Testing DTO's to with in memory "DB"
{
    ApiResponse response = new ApiResponse();
   
    response.Result = ProductStore.productlist
    .Select(product => _mapper.Map<ProductDTO>(product)).ToList();

    response.IsSucces = true;
    response.StatusCode = System.Net.HttpStatusCode.OK;
    return Results.Ok(response);

}).WithName("GetProducts").Produces(200);
Editor is loading...