public User Deletar(User user) { _context.Users.Remove(user); _context.SaveChanges(); return(user); }
public Event Deletar(Event evento) { _context.Events.Remove(evento); _context.SaveChanges(); return(evento); }
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; }
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(); } } }
public void Save(T entity) { _context.Set <T>().Add(entity); _context.SaveChanges(); }
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(); }