// inserting data into database public CurrenciesController(CurrenciesContext context) { _context = context; if (_context.CurrenciesItems.Count() == 0) { _context.CurrenciesItems.Add(new CurrencyItem { Code = "USD", Name = "Dólar", Value = 2.35, }); _context.CurrenciesItems.Add(new CurrencyItem { Code = "EUR", Name = "Euro", Value = 3.90, }); _context.SaveChanges(); } }
public UnitOfWork(CurrenciesContext context) { Context = context; Context.Database.EnsureCreated(); }