Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IEnumerable<ISession> GetSessions()
- {
- var result = new List<ISession>();
- SiteEntity currSite;
- try
- {
- using (var dbContext = new AuctionSiteDbContext(_connectionString))
- {
- currSite = dbContext.Sites
- .Where(x => x.Name.Equals(Name))
- .Include(x => x.Sessions.Select(y=> y.UserEntity))
- .FirstOrDefault();
- }
- if (currSite == null)
- throw new InvalidOperationException();
- }
- catch (Exception e)
- {
- InCommon.ExceptionCatching(e, null);
- throw;
- }
- foreach (var sessionEntity in currSite.Sessions)
- {
- result.Add(new Session(this, _connectionString, _alarmClock, sessionEntity.SessionId, sessionEntity.ValidUntil, new User(_connectionString, this, _alarmClock, sessionEntity.UserEntity.Username)));
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement