Example #1
0
        private ActionResult CookiesAndContextAssignation(ApplicationUserDto applicationUser)
        {
            FormsAuthentication.SetAuthCookie(applicationUser.ApplicationUserId.ToString(), false);
            Response.Cookies.Add(new HttpCookie("TenantId", applicationUser.TenantId.ToString()));
            Response.Cookies.Add(new HttpCookie("TenantDomainName", applicationUser.TenantDomain));
            Response.Cookies.Add(new HttpCookie("Email", applicationUser.Email));
            Response.Cookies.Add(new HttpCookie("UserId", applicationUser.ApplicationUserId.ToString()));

            HttpCookie myCookie = new HttpCookie("Blitz");
            DateTime now = DateTime.Now;
            myCookie.Value = applicationUser.Email;
            myCookie.Expires = now.AddDays(10);
            Response.Cookies.Add(myCookie);

            return RedirectToAction("Index", "Scheduler", new { area = "" });
        }
Example #2
0
        public ApplicationUserDto GetUserAccountInformation(Guid userId)
        {
            using (var db = new AdministrationDb())
            {
                var user = db.ApplicationUsers.SingleOrDefault(x => x.UserId == userId);

                if (user == null) return null;

                var customerInfo = user.CustomerUsers.FirstOrDefault().Customer;
                var applicationUser = new ApplicationUserDto
                {
                    ApplicationUserId = user.UserId,
                    Email = user.EmailAddress,
                    Active = user.IsActive,
                    FirstName = user.FirstName,
                    LastName = user.LastName,
                    TenantId = customerInfo.CustomerId,
                    TenantDomain = customerInfo.DomainName
                };
                return applicationUser;
            }
        }