public ActionResult Edit(Guid id) { var custodian = _custodiansQuery.GetCustodian(id); if (custodian == null) { return(NotFound("custodian", "id", id)); } var credentials = _loginCredentialsQuery.GetCredentials(custodian.Id); if (credentials == null) { return(NotFound("custodian", "id", id)); } return(View(new CustodianUserModel { User = custodian, UserLogin = new CustodianLoginModel { LoginId = credentials.LoginId }, Community = _communitiesQuery.GetCommunity(custodian.AffiliateId.Value), })); }
RegisteredUser IUsersQuery.GetUser(Guid id) { // Go through the list. var member = _membersQuery.GetMember(id); if (member != null) { return(member); } var employer = _employersQuery.GetEmployer(id); if (employer != null) { return(employer); } var custodian = _custodiansQuery.GetCustodian(id); if (custodian != null) { return(custodian); } return(_administratorsQuery.GetAdministrator(id)); }
void ICustodianAccountsCommand.UpdateCustodian(Custodian custodian) { // Maintain the state of the email address. if (custodian.EmailAddress != null) { var originalCustodian = _custodiansQuery.GetCustodian(custodian.Id); custodian.EmailAddress.IsVerified = originalCustodian.EmailAddress == null || custodian.EmailAddress.Address != originalCustodian.EmailAddress.Address || originalCustodian.EmailAddress.IsVerified; } _custodiansCommand.UpdateCustodian(custodian); }
private void AssertSavedLogins(Community community, ICollection <Custodian> expectedCustodians) { var custodians = _custodiansQuery.GetAffiliationCustodians(community.Id); Assert.AreEqual(expectedCustodians.Count, custodians.Count); foreach (var expectedCustodian in expectedCustodians) { var id = _loginCredentialsQuery.GetUserId(expectedCustodian.GetLoginId()); var custodian = _custodiansQuery.GetCustodian(id.Value); Assert.IsNotNull(custodian); // Check one of the recrutiers for the organisation. Assert.AreEqual(true, (from r in custodians where r.Id == custodian.Id select r).Any()); // Check one of the recrutiers for the community. Assert.AreEqual(expectedCustodian.EmailAddress, custodian.EmailAddress); Assert.AreEqual(expectedCustodian.FirstName, custodian.FirstName); Assert.AreEqual(expectedCustodian.LastName, custodian.LastName); Assert.AreEqual(expectedCustodian.GetLoginId(), custodian.GetLoginId()); } }
public void TestCreateAccount() { var custodian = _custodianAccountsCommand.CreateTestCustodian(0, Guid.NewGuid()); AssertAreEqual(custodian, _custodiansQuery.GetCustodian(custodian.Id)); }