public ActionResult ChangeEmail(ChangeEmail model) { if (!ModelState.IsValid) return View(model); var changeEmailSucceeded = true; try { var u = MembershipService.GetUser(User.Identity.Name); if (u != null) { u.Email = model.Email; MembershipService.UpdateUser(u); } AccountHelper.ChangeEmailByType(model); } catch (Exception) { changeEmailSucceeded = false; } if (changeEmailSucceeded) { return RedirectToAction("ChangeEmailSuccess"); } ModelState.AddModelError("", @"The email address is incorrect."); return View(model); }
public ChangeEmail ThirdChangeEmail() { var thirdChangeEmail = new ChangeEmail { Email = null }; return thirdChangeEmail; }
public ChangeEmail SecondChangeEmail() { var secondChangeEmail = new ChangeEmail { Email = null }; return secondChangeEmail; }
public ChangeEmail FirstChangeEmail() { var firstChangeEmail = new ChangeEmail { Email = null }; return firstChangeEmail; }
/// ChangeEmail /// public void ChangeTenantEmail(ChangeEmail model) { //Tenant var tenantId = UserHelper.UserIdentity.GetTenantId(); if (tenantId == 0) { UserHelper.Login(); } else { var tenant = UserHelper.TenantPrivateProfileHelper.GetPrivateProfileTenantByTenantId(tenantId); { if (tenant != null) tenant.EmailAddress = model.Email; } UnitofWork.Save(); } }
public void ChangeSpecialistEmail(ChangeEmail model) { //Specialist var specialistId = UserHelper.UserIdentity.GetSpecialistId(); if (specialistId == 0) { UserHelper.Login(); } else { var specialist = UserHelper.SpecialistPrivateProfileHelper.GetPrivateProfileSpecialistBySpecialistId(specialistId); { if (specialist != null) specialist.EmailAddress = model.Email; } UnitofWork.Save(); } }
public void ChangeProviderEmail(ChangeEmail model) { //MaintenanceProvider var providerId = UserHelper.UserIdentity.GetProviderId(); if (providerId == 0) { UserHelper.Login(); } else { var provider = UserHelper.ProviderPrivateProfileHelper.GetPrivateProfileProviderByProviderId(providerId); { if (provider != null) provider.EmailAddress = model.Email; } UnitofWork.Save(); } }
public void ChangeOwnerEmail(ChangeEmail model) { //Owner var ownerId = UserHelper.UserIdentity.GetOwnerId(); if (ownerId == 0) { UserHelper.Login(); } else { var owner = UserHelper.OwnerPrivateProfileHelper.GetPrivateProfileOwnerByOwnerId(ownerId); { if (owner != null) owner.EmailAddress = model.Email; } UnitofWork.Save(); } }
public void ChangeEmailByType(ChangeEmail model) { if (HttpContext.User.IsInRole(LookUpRoles.TenantRole)) { ChangeTenantEmail(model); } if (HttpContext.User.IsInRole(LookUpRoles.OwnerRole)) { ChangeOwnerEmail(model); } if (HttpContext.User.IsInRole(LookUpRoles.AgentRole)) { ChangeAgentmail(model); } if (HttpContext.User.IsInRole(LookUpRoles.SpecialistRole)) { ChangeSpecialistEmail(model); } if (HttpContext.User.IsInRole(LookUpRoles.ProviderRole)) { ChangeProviderEmail(model); } }
public void ChangeAgentmail(ChangeEmail model) { //Agent var agentId = UserHelper.UserIdentity.GetAgentId(); if (agentId == 0) { UserHelper.Login(); } else { var agent = UserHelper.AgentPrivateProfileHelper.GetAgentPrivateProfileByAgentId(agentId); { if (agent != null) agent.EmailAddress = model.Email; } UnitofWork.Save(); } }
public void ChangeTenantEmail() { var newEmail = new ChangeEmail { Email = "new Tenant Email.com" }; Controller.UserHelper.UserIdentity.MockTenantFred(); Controller.ChangeTenantEmail(newEmail); var email = Uow.TenantRepository.FindBy(x => x.TenantId == 5).FirstOrDefault(); Debug.Assert(email != null, "email != null"); Assert.AreEqual(email.EmailAddress, "new Tenant Email.com"); }
public void ChangeSpecialistEmail() { var newEmail = new ChangeEmail { Email = "new Specialist Email.com" }; Controller.UserHelper.UserIdentity.MockSaraSpecialist(); Controller.ChangeSpecialistEmail(newEmail); var email = Uow.SpecialistRepository.FindBy(x => x.SpecialistId == 1).FirstOrDefault(); Debug.Assert(email != null, "email != null"); Assert.AreEqual(email.EmailAddress, "new Specialist Email.com"); }
public void ChangeProviderEmail() { var newEmail = new ChangeEmail { Email = "new Provider Email.com" }; Controller.UserHelper.UserIdentity.MockJeffProvider(); Controller.ChangeProviderEmail(newEmail); var email = Uow.MaintenanceProviderRepository.FindBy(x => x.MaintenanceProviderId == 1).FirstOrDefault(); Debug.Assert(email != null, "email != null"); Assert.AreEqual(email.EmailAddress, "new Provider Email.com"); }