예제 #1
0
        public bool CreateModels()
        {
            bool homiesNewlyCreated = false;

            if (!_context.Locations.Any())
            {
                _context.Locations.AddRange(CreateRandomLocations(5));
            }

            if (!_context.Homies.Any())
            {
                _context.AddRange(CreateRandomHomies(10));
                homiesNewlyCreated = true;
            }

            _context.SaveChanges();
            return(homiesNewlyCreated);
        }
예제 #2
0
 public void Add(T entity)
 {
     _dbContext.Set <T>().Add(entity);
     _dbContext.SaveChanges();
 }