private async Task ValidateForm(RegistrationRequest registrationRequest) { if (registrationRequest == null) { throw new CallerException("Registration Form Cannot be null."); } if (string.IsNullOrEmpty(registrationRequest.Username)) { throw new CallerException("Username field is required."); } if (registrationRequest.Username.Any(char.IsWhiteSpace)) { throw new CallerException("Username may not contain spaces."); } var usernameLogic = new UsernameLogic(Cache, SettingRequester, UserContext); await usernameLogic.ValidateUsername(registrationRequest.Username); if (string.IsNullOrEmpty(registrationRequest.RegistrationChannel)) { throw new CallerException("Registration Channel is required."); } }
public async Task <BudgetUser> Put(int userid, string proposedUsername) { var usernameLogic = new UsernameLogic(Cache, SettingRequester, Context); return(await usernameLogic.UpdateUsername(userid, proposedUsername)); }