예제 #1
0
        public async Task <IActionResult> UpdateAsync([FromBody] AccountUpdateRequest request)
        {
            try
            {
                var userCheckin = await _repo.GetUserCheckinAsync(request.Code);

                if (userCheckin == null)
                {
                    return(NotFound($"Actual user checkin with code={request.Code} not found"));
                }
                await _repo.ChangeAccountAsync(userCheckin, request.UserName, request.UserPassword);

                return(Ok());
            }
            catch (UserAccountException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"error {nameof(AccountController.UpdateAsync)} {this.GetType().Name}");
                return(InternalServerError(ex));
            }
        }