/*Custom methods for this repo */ public IEnumerable <LifeEvent> GetLifeEventsCreatedByUser(int userId) { using (LifeEventsDBContext dbContext = new LifeEventsDBContext()) { return((from e in dbContext.LifeEvents where e.CreatedByUserId == userId select e).ToList()); } }
/*Custom methods for this specific Repository */ public User Get(string userName) { using (LifeEventsDBContext dbContext = new LifeEventsDBContext()) { return((from e in dbContext.Users where e.LoginName == userName select e).FirstOrDefault()); } }
/*Custom methods for this specific Repository */ public IEnumerable <RelationshipGroup> GetGroupsCreatedByUser(int userId) { using (LifeEventsDBContext dbContext = new LifeEventsDBContext()) { return((from e in dbContext.RelationshipGroups where e.CreatedByUserId == userId select e).ToList()); } }
protected override User UpdateEntity(LifeEventsDBContext dbContext, User entity) { return((from e in dbContext.Users where e.UserId == entity.UserId select e).FirstOrDefault()); }
protected override User GetEntity(LifeEventsDBContext dbContext, int id) { return((from e in dbContext.Users where e.UserId == id select e).FirstOrDefault()); }
protected override IEnumerable <User> GetEntities(LifeEventsDBContext dbContext) { return(from e in dbContext.Users select e); }
protected override User AddEntity(LifeEventsDBContext dbContext, User entity) { return(dbContext.Users.Add(entity)); }
protected override LifeEvent UpdateEntity(LifeEventsDBContext dbContext, LifeEvent entity) { return((from e in dbContext.LifeEvents where e.LifeEventId == entity.LifeEventId select e).FirstOrDefault()); }
protected override LifeEvent AddEntity(LifeEventsDBContext dbContext, LifeEvent entity) { return(dbContext.LifeEvents.Add(entity)); }
protected override RelationshipGroup UpdateEntity(LifeEventsDBContext dbContext, RelationshipGroup entity) { return((from e in dbContext.RelationshipGroups where e.RelationshipGroupId == entity.RelationshipGroupId select e).FirstOrDefault()); }
protected override RelationshipGroup GetEntity(LifeEventsDBContext dbContext, int id) { return((from e in dbContext.RelationshipGroups where e.RelationshipGroupId == id select e).FirstOrDefault()); }
protected override IEnumerable <RelationshipGroup> GetEntities(LifeEventsDBContext dbContext) { return(from e in dbContext.RelationshipGroups select e); }
protected override RelationshipGroup AddEntity(LifeEventsDBContext dbContext, RelationshipGroup entity) { return(dbContext.RelationshipGroups.Add(entity)); }