public DatabaseFixture() { var options = new DbContextOptionsBuilder <CustomerDbContext>() .UseInMemoryDatabase(databaseName: "CustomerDbNew") .Options; dbcontext = new CustomerDbContext(options); dbcontext.Customers.Add(new Customer { Name = "karthik110", Username = "******", Password = "******", Address = null, State = null, Country = null, EmailAddress = null, PAN = null, ContactNumber = null, DOB = Convert.ToDateTime("2000-12-31T23:59:59"), AccountType = null }); dbcontext.Customers.Add(new Customer { Name = "karthik102", Username = "******", Password = "******", Address = null, State = null, Country = null, EmailAddress = null, PAN = null, ContactNumber = null, DOB = Convert.ToDateTime("2000-12-31T23:59:59"), AccountType = null }); dbcontext.Customers.Add(new Customer { Name = "karthik103", Username = "******", Password = "******", Address = null, State = null, Country = null, EmailAddress = null, PAN = null, ContactNumber = null, DOB = Convert.ToDateTime("2000-12-31T23:59:59"), AccountType = null }); dbcontext.SaveChanges(); }
private int SaveChanges() { return(_context.SaveChanges()); }
public void AddCustomer(Customer customer) { _context.Customers.Add(customer); _context.SaveChanges(); }