public async Task <IActionResult> PostOffer(OfferDb dataOffer) { try { await offerunit.RepositoryOffer.SaveOffer(dataOffer); await offerunit.Complete(); return(Ok(msgOK)); } catch (Exception ex) { return(BadRequest(msgError)); } }
public static void Main(string[] args) { IWebHost webHost = CreateWebHostBuilder(args).Build(); using (IServiceScope serviceScope = webHost.Services.CreateScope()) { using (OfferDbContext offerDbContext = serviceScope.ServiceProvider.GetRequiredService <OfferDbContext>()) { var roleManager = serviceScope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >(); OfferDb.Seed(offerDbContext, roleManager); } } webHost.Run(); }
public async Task SaveOffer(OfferDb offerData) { await _dbContext.AddAsync(offerData); }