예제 #1
0
        public User Deletar(User user)
        {
            _context.Users.Remove(user);

            _context.SaveChanges();

            return(user);
        }
예제 #2
0
        public Event Deletar(Event evento)
        {
            _context.Events.Remove(evento);

            _context.SaveChanges();

            return(evento);
        }
예제 #3
0
 public Log Save(Log log)
 {
     log.CreatedAt = DateTime.Now;
     var state = log.Id == 0 ? EntityState.Added : EntityState.Modified;
     log.User = _context.Users.Where(el => el.Id == log.UserId).FirstOrDefault();
     _context.Entry(log).State = state;
     _context.SaveChanges();
     return log;
 }
예제 #4
0
        public User Save(User user)
        {
            var state = user.Id == 0 ? EntityState.Added : EntityState.Modified;

            context.Entry(user).State = state;
            context.SaveChanges();
            return(user);
        }
 public void FillWith <T>() where T : class
 {
     using (var context = new CentralErrosContext(FakeOptions))
     {
         if (context.Set <T>().Count() == 0)
         {
             foreach (T item in GetFakeData <T>())
             {
                 context.Set <T>().Add(item);
             }
             context.SaveChanges();
         }
     }
 }
예제 #6
0
 public void Save(T entity)
 {
     _context.Set <T>().Add(entity);
     _context.SaveChanges();
 }
예제 #7
0
 public void ChangeStatus(Error error)
 {
     error.Status = error.Status == 'y' ? 'n' : 'y';
     _context.Update(error);
     _context.SaveChanges();
 }
 public void Save(User user)
 {
     _context.Users.Add(user);
     _context.SaveChanges();
 }