Example #1
0
        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));
            }
        }
Example #2
0
        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();
        }
Example #3
0
 public async Task SaveOffer(OfferDb offerData)
 {
     await _dbContext.AddAsync(offerData);
 }