public async Task <T> Add(T entity) { var dbEntity = _context.Set <T>().Add(entity).Entity; _context.SaveChanges(); return(dbEntity); }
public void RunSeed() { //Apagando e recriando o banco de dados _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); //Salvando os objetos e atribuindo as instâncias as variáveis do seed CreateProjectReservation(); //Confirmando alterações _context.SaveChanges(); }
public static void PopulateTestData(ProjectsPortifolioDbContext dbContext) { dbContext.Project.Add(ProjectBuilder.Start().Build()); dbContext.SaveChanges(); }