public async Task <Versioned <AdminUserSettingsForClient> > SaveUserSetting(SaveUserSettingsArguments args) { await Initialize(); // Retrieve the arguments var key = args.Key; var value = args.Value; // Validation int maxKey = 255; int maxValue = 2048; if (string.IsNullOrWhiteSpace(key)) { // Key is required throw new ServiceException(_localizer[ErrorMessages.Error_Field0IsRequired, nameof(args.Key)]); } else if (key.Length > maxKey) { // throw new ServiceException(_localizer[ErrorMessages.Error_Field0LengthMaximumOf1, nameof(args.Key), maxKey]); } if (value != null && value.Length > maxValue) { throw new ServiceException(_localizer[ErrorMessages.Error_Field0LengthMaximumOf1, nameof(args.Value), maxValue]); } // Save and return await _repo.AdminUsers__SaveSettings(key, value); return(await UserSettingsForClient(cancellation : default));
public async Task <ActionResult <Versioned <AdminUserSettingsForClient> > > SaveUserSetting(SaveUserSettingsArguments args) { return(await ControllerUtilities.InvokeActionImpl(async() => { var result = await _service.SaveUserSetting(args); return Ok(result); }, _logger)); }
public async Task <ActionResult <Versioned <AdminUserSettingsForClient> > > SaveUserSetting(SaveUserSettingsArguments args) { var result = await _service.SaveUserSetting(args); return(Ok(result)); }