public TModel Add(TModel obj)
        {
            obj.Id        = Guid.NewGuid();
            obj.CreatedAt = obj.UpdatedAt = DateTime.UtcNow;

            _context.Set <TModel>().Add(obj);
            _context.SaveChanges();
            return(obj);
        }
        private Frequency createFrequencyOfLogDescription(string logDescription)
        {
            Frequency frequency = new Frequency()
            {
                LogDescription = logDescription,
                NumberOfEvents = 1
            };

            var state = EntityState.Added;

            context.Entry(frequency).State = state;
            context.SaveChanges();

            return(frequency);
        }
 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();
         }
     }
 }
 public void DeleteError(int id)
 {
     context.Remove(context.Errors.Single(error => error.Id == id));
     context.SaveChanges();
 }
 public int Save(Error error)
 {
     _context.Errors.Add(error);
     return(_context.SaveChanges());
 }