public async Task <IActionResult> Create([Bind("ClimateID,Name,Description,Rain_in_Winter,Rain_during_Growing_Season,Rain_during_Harvest,Temp_in_Winter,Temp_during_Growing_Season,Temp_Continentality,Temp_Diurnal,Vintage_Variation,Proximity_to_Large_Bodies_of_Water")] Climate climate) { if (ModelState.IsValid) { _context.Add(climate); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(climate)); }
public async Task Handle(UpdateVinmonopoletRepositoryCommand message, IMessageHandlerContext context) { var vinmonopoletProducts = await FetchNewProductList(); await _db.Database.ExecuteSqlCommandAsync("TRUNCATE TABLE public.\"Products\""); await _db.Products.AddRangeAsync(vinmonopoletProducts); Console.WriteLine("Writing products"); await _db.SaveChangesAsync(); Console.WriteLine("Saving..."); }