コード例 #1
0
ファイル: SettingsController.cs プロジェクト: formist/LinkMe
        private void Prepare(UnsubscribeRequestModel requestModel, UnsubscribeModel unsubscribeModel)
        {
            requestModel.Prepare();
            requestModel.Validate();

            // Get the user.

            var user = _usersQuery.GetUser(requestModel.UserId.Value);

            if (user == null)
            {
                throw new ValidationErrorsException(new NotFoundValidationError("UserId", requestModel.UserId.Value));
            }

            if (CurrentRegisteredUser == null)
            {
                unsubscribeModel.Login.LoginId = _loginCredentialsQuery.GetLoginId(requestModel.UserId.Value);
            }

            // Get the category.

            unsubscribeModel.Category = _settingsQuery.GetCategory(requestModel.Category);
            if (unsubscribeModel.Category == null)
            {
                throw new ValidationErrorsException(new NotFoundValidationError("Category", requestModel.Category));
            }
        }