예제 #1
0
 public void UpdateSettings(UpdateUserSettingsCommand command)
 {
     if (!string.IsNullOrEmpty(command.DefaultLanguage))
     {
         DefaultLanguage = command.DefaultLanguage;
     }
 }
        public async Task <IActionResult> UpdateUserSettings(int userId, UserForUpdateDto userForUpdateDto)
        {
            var command = new UpdateUserSettingsCommand(userId, userForUpdateDto);
            var result  = await Mediator.Send(command);

            if (result != null)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest());
            }
        }
예제 #3
0
        public async Task <IActionResult> ChangeSettingsAsync(
            [FromBody] UpdateSettingsRequest model,
            [ProfileModelBinder(ProfileServiceQuery.Country)] UserProfile profile,
            CancellationToken token)
        {
            var userId  = _userManager.GetLongUserId(User);
            var command = new UpdateUserSettingsCommand(userId, model.FirstName, model.LastName,
                                                        model.Description, model.Bio, model.Price);
            await _commandBus.DispatchAsync(command, token);

            var culture = CultureInfo.CurrentCulture.ChangeCultureBaseOnCountry(profile.Country);

            return(Ok(new
            {
                newPrice = model.Price?.ToString("C0", culture)
            }));
        }
예제 #4
0
        public async Task <IActionResult> UpdateSettings([FromBody] UpdateUserSettingsCommand command)
        {
            var result = await _mediator.Send(command);

            return(Ok(result));
        }