play with storing valueobjects

This commit is contained in:
Claudiu Farcas
2022-10-18 00:03:51 +03:00
parent 80ccd22d9c
commit b31cbcc15d
36 changed files with 250 additions and 81 deletions
@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using PracticeCalendar.API.Controllers;
using PracticeCalendar.Application.Products.Queries;
using PracticeCalendar.Application.Products.Queries.GetProducts;
namespace PracticeCalendar.Api.Controllers
{
public class ProductsController : ApiControllerBase
{
private readonly ILogger<ProductsController> logger;
public ProductsController(ILogger<ProductsController> logger)
{
this.logger = logger;
}
[HttpGet]
public async Task<ActionResult<List<ProductDto>>> Get()
{
return await Mediator.Send(new GetProductsQuery());
}
}
}
+4 -6
View File
@@ -9,7 +9,7 @@ namespace PracticeCalendar
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
@@ -51,13 +51,11 @@ namespace PracticeCalendar
using (var scope = app.Services.CreateScope())
{
var services = scope.ServiceProvider;
try
{
var context = services.GetRequiredService<ApplicationDbContext>();
//context.Database.Migrate();
context.Database.EnsureCreated();
//SeedData.Initialize(services);
var initialiser = services.GetRequiredService<ApplicationDbContextInitialiser>();
await initialiser.InitialiseAsync();
await initialiser.SeedAsync();
}
catch (Exception ex)
{
Binary file not shown.