public static void Main(string[] args) { var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var serviceProviders = scope.ServiceProvider; var context = serviceProviders.GetRequiredService <EventCatalogContext>(); EventCatalogSeed.Seed(context); } host.Run(); }
public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; var context = services.GetRequiredService <EventCatalogContext>(); EventCatalogSeed.SeedAsync(context).Wait(); } host.Run(); }
public static void Main(string[] args) { var host = CreateWebHostBuilder(args).Build();//build the host using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; //Find all services (Startup,cs) var context = services.GetRequiredService <EventCatalogContext>(); //Check if catalogcontext service is running EventCatalogSeed.Seed(context); //If yes, then seed the database } host.Run(); //run the host }
public async Task <IActionResult> EventDetails([FromForm] EventInputData eventInput, IFormFile File) { var result = await EventCatalogSeed.UpdateEvent(eventInput, _context, File, _env); if (result == "Event Addition Succesful") { return(Ok(result)); } else { return(Problem(result)); } }
//included public async Task <IActionResult> EventDetails([FromForm] string eventInput, IFormFile File) { var str = eventInput; EventInputData eventInput1 = new EventInputData(); eventInput1 = JsonConvert.DeserializeObject <EventInputData>(eventInput); var result = await EventCatalogSeed.UpdateEvent(eventInput1, _context, File, _env); if (result == "Event Addition Succesful") { return(Ok(result)); } else { return(Problem(result)); } }