Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
430 B
2
Indexable
Never
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);