public ActionResult Profile() { BGBC.Model.User user = _userRepository.Get(((BGBC.Core.CustomPrincipal)(User)).UserId); UserProfile userProfile = new TenantProfile { FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, ConfirmEmail = user.Email, Createdon = user.Createdon, Updatedon = user.Updatedon }; return(View(userProfile)); }
public ActionResult Profile() { BGBC.Model.User user = _userRepository.Get(((BGBC.Core.CustomPrincipal)(User)).UserId); Profile profile = _profileRepo.Get(((BGBC.Core.CustomPrincipal)(User)).UserId); UserProfile userProfile = new TenantProfile { FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, ConfirmEmail = user.Email, Createdon = user.Createdon, Updatedon = user.Updatedon, AltEmail = profile.AltEmail, ConfirmAltEmail = profile.AltEmail, ProfileInfo = profile }; PopulateDropDown(); return(View(userProfile)); }
private void AssertTenantProfiles(IEnumerable <TenantProfile> tenantProfiles, string tenantId) { Assert.IsNotNull(tenantProfiles); Assert.IsTrue(tenantProfiles.Count() > 0); TenantProfile tenantProfile = tenantProfiles.Single(tp => tp.TenantId == tenantId); Assert.IsNotNull(tenantProfile); Assert.IsNotNull(tenantProfile.ClaimsPrincipal); Assert.IsNotNull(tenantProfile.ClaimsPrincipal.FindFirst(claim => claim.Type == "tid" && claim.Value == tenantId)); }
public ActionResult Register(TenantProfile model) { if (ModelState.IsValid) { var credential = "Tenant_" + model.TenantName; model.TenantDatabaseName = credential; model.TenantDatabaseUsername = credential; model.TenantDatabasePassword = credential; //Provisioning process of new Tenant NewTenantProvisioning.DoProvisioning(model); //Adding new tenant to Tenant table _db.TenantProfiles.Add(model); _db.SaveChanges(); //Attempt to register the user for newly addes user try { WebSecurity.CreateUserAndAccount(model.UserName, model.Password, new { FirstName = model.FirstName, LastName = model.LastName, EmailAdress = model.EmailAdress, WorkPhone = model.PhoneNumber, @UserTenantProfile_TenantId = model.TenantId, }); WebSecurity.Login(model.UserName, model.Password); return(RedirectToAction("Index", "Home")); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } } // If we got this far, something failed, redisplay form return(View(model)); }