public TModel Add(TModel obj) { obj.Id = Guid.NewGuid(); obj.CreatedAt = obj.UpdatedAt = DateTime.UtcNow; _context.Set <TModel>().Add(obj); _context.SaveChanges(); return(obj); }
public void FillWith <T>() where T : class { using (var context = new CentralDeErrosContext(FakeOptions, _configuration)) { if (context.Set <T>().Count() == 0) { foreach (T item in GetFakeData <T>()) { context.Set <T>().Add(item); } context.SaveChanges(); } } }