private Clubs_PhoneNumbersDTO GetRelation(PhoneNumberDTO phoneNumber) { phoneNumber = phoneNumber.Id == 0 ? DbEntityExistensChecker.TryGetExistingPhoneNumberFromDb(phoneNumber) : phoneNumber; return(ServiceLocator.ClubsPhoneNumbersService.FindBy( cpJunc => cpJunc.ClubId == Id && cpJunc.PhoneNumberId == phoneNumber.Id) .First()); }
public void AddPhoneNumberToClub(UserDTO caller, PhoneNumberDTO phoneNumber) { NullCheck.ThrowArgumentNullEx(caller, phoneNumber); CheckPermission(caller); phoneNumber = phoneNumber.Id == 0 ? DbEntityExistensChecker.TryGetExistingPhoneNumberFromDb(phoneNumber) ?? DbEntityAdder.AddPhoneNumberToDb(phoneNumber) : phoneNumber; SaveRelationToDb(CreateRelation(phoneNumber)); }
public void AddRoleRelation(UserDTO caller, UserDTO user, PhoneNumberDTO phoneNumber, Role role) { NullCheck.ThrowArgumentNullEx(user, phoneNumber); _target.CheckPermission(caller); user = user.Id == 0 ? DbEntityExistensChecker.TryGetExistingUserFromDb(user) ?? DbEntityAdder.AddUserToDb(user) : user; phoneNumber = phoneNumber.Id == 0 ? DbEntityExistensChecker.TryGetExistingPhoneNumberFromDb(phoneNumber) ?? DbEntityAdder.AddPhoneNumberToDb(phoneNumber) : phoneNumber; AddRoleRelationToDb(CreateRoleRelation(user, phoneNumber, role)); }