public BifSessionData(string id = null) { EFUnitOfWork dal = EFUnitOfWork.Create(HttpContext.Current.Application["connectionString"].ToString()); if (id == null) { id = HttpContext.Current.User.Identity.Name ?? ""; } var user = dal.Context.Users.Where(x => x.Id == id) .Select(x => new { Identity = x, Profile = x.Profile, Claims = x.Claims, Roles = x.Roles }) .FirstOrDefault(); HttpCookie cookie = CookieManager.GetCookie("exchangeId") ?? setExchangeCookie(); int.TryParse(cookie?.Value, out int exchangeId); Id = id; Username = user?.Profile?.RedditUsername; Email = user?.Identity?.Email; HasProfile = user?.Profile != null; Claims = user?.Identity?.Claims.ToList(); Roles = user?.Identity?.Roles.ToList(); UserStatus = (int?)user?.Identity?.UserStatus ?? 0; ExchangeId = exchangeId; }
private BifUserStore() { _dal = EFUnitOfWork.Create(HttpContext.Current.Application["connectionString"].ToString()); }