public void Delete(Agenda entity) { using (FriendContext context = new FriendContext()) { context.Agendas.Remove(entity); } }
public ICollection <Agenda> GetAll() { using (FriendContext context = new FriendContext()) { return(context.Agendas.ToList()); } }
public IEnumerable <Agenda> GetAll() { using (FriendContext context = new FriendContext()) { return(context.Agendas.ToList()); } }
public ICollection <User> GetAll() { using (FriendContext context = new FriendContext()) { return(context.Users.ToList()); } }
public void Delete(User entity) { using (FriendContext context = new FriendContext()) { context.Users.Remove(entity); } }
public IEnumerable <User> GetAllUser() { using (FriendContext context = new FriendContext()) { return(context.Users.ToList()); } }
public void Add(Agenda entity) { using (FriendContext context = new FriendContext()) { context.Agendas.Add(entity); context.SaveChanges(); } }
public void Add(User entity) { using (FriendContext context = new FriendContext()) { context.Users.Add(entity); context.SaveChanges(); } }
public User Get(string name) { using (FriendContext context = new FriendContext()) { var user = context.Users.Single(o => o.Name == name); return(user); } }
public User Get(Guid id) { using (FriendContext context = new FriendContext()) { var user = context.Users.Single(o => o.Id == id); return(user); } }
public void DeleteUser(User entity) { using (FriendContext context = new FriendContext()) { context.Users.Attach(entity); context.Users.Remove(entity); context.SaveChanges(); } }
public void Delete(Agenda entity) { using (FriendContext context = new FriendContext()) { context.Agendas.Attach(entity); context.Agendas.Remove(entity); context.SaveChanges(); } }
public void Delete(Agenda entity) { using (FriendContext context = new FriendContext()) { var customer = context.Agendas.Single(o => o.Id == entity.Id); context.Agendas.Remove(customer); context.SaveChanges(); } }
public void Delete(User entity) { using (FriendContext context = new FriendContext()) { var user = context.Users.Single(o => o.Id == entity.Id); context.Users.Remove(user); context.SaveChanges(); } }
public Agenda Get(Guid id) { using (FriendContext context = new FriendContext()) { Agenda agenda = context.Agendas.FirstOrDefault(a => a.Id == id); context.Entry(agenda).Reference(a => a.Owner).Load(); context.Entry(agenda).Collection(a => a.Contacts).Load(); return(agenda); } }
public User Get(Guid id) { using (FriendContext context = new FriendContext()) { User user = context.Users.FirstOrDefault(a => a.Id == id); context.Entry(user).Collection(a => a.Agendas).Load(); //context.Entry(user).Collection(a => a.Contacts).Load(); return(user); } }
public void Modify(User entity) { using (FriendContext context = new FriendContext()) { var user = (from u in context.Users where u.Id == entity.Id select u).FirstOrDefault(); user.Age = entity.Age; user.Agendas = entity.Agendas; user.Name = entity.Name; context.SaveChanges(); } }
public void Modify(Agenda entity) { using (FriendContext context = new FriendContext()) { context.Entry(entity).State = EntityState.Modified; context.Entry(entity.Owner).State = EntityState.Modified; foreach (var contact in entity.Contacts) { context.Entry(contact).State = contact.Id.Equals(Guid.Empty) ? EntityState.Added : EntityState.Unchanged; } context.SaveChanges(); } }
public void Modify(User entity) { using (FriendContext context = new FriendContext()) { context.Entry(entity).State = EntityState.Modified; //context.Entry(entity.Owner).State = EntityState.Modified; foreach (var agenda in entity.Agendas) { context.Entry(agenda).State = agenda.Id.Equals(Guid.Empty) ? EntityState.Added : EntityState.Unchanged; } context.SaveChanges(); } }