public void Seed() { using (EfDbContext context = new EfDbContext()) { var clients = new List<Client> { new Client { FirstName = "Jack", SecondName = "Smith", AccountNumber = "5157543365437123", Balance = 10000 }, new Client { FirstName = "Anna", SecondName = "Dawson", AccountNumber = "5157845684569855", Balance = 5650 }, new Client { FirstName = "Tony", SecondName = "Spark", AccountNumber = "5157095600443356", Balance = 15000 } }; clients.ForEach(p => context.Clients.Add(p)); context.SaveChanges(); } }
public List<Client> GetAllClients() { using (var context = new EfDbContext()) { if (context.Clients.Count() != 0) { return context.Clients.ToList(); } return null; } }