public void AddEmailToClub(UserDTO caller, EmailDTO email) { NullCheck.ThrowArgumentNullEx(caller, email); CheckPermission(caller); email = email.Id == 0 ? DbEntityExistensChecker.TryGetExistingEmailFromDb(email) ?? DbEntityAdder.AddEmailToDb(email) : email; SaveRelationToDb(CreateRelation(email)); }
private Clubs_EmailsDTO GetRelation(EmailDTO email) { email = email.Id == 0 ? DbEntityExistensChecker.TryGetExistingEmailFromDb(email) : email; return(ServiceLocator.ClubsEmailsService.FindBy( ceJunc => ceJunc.ClubId == Id && ceJunc.EmailId == email.Id) .First()); }
public void AddRoleRelation(UserDTO caller, UserDTO user, EmailDTO email, Role role) { NullCheck.ThrowArgumentNullEx(user, email); _target.CheckPermission(caller); user = user.Id == 0 ? DbEntityExistensChecker.TryGetExistingUserFromDb(user) ?? DbEntityAdder.AddUserToDb(user) : user; email = email.Id == 0 ? DbEntityExistensChecker.TryGetExistingEmailFromDb(email) ?? DbEntityAdder.AddEmailToDb(email) : email; AddRoleRelationToDb(CreateRoleRelation(user, email, role)); }