public async Task UpdateUserConfig(UpdateUserConfigViewModel userConfig) { var userId = _httpContextAccessor.HttpContext.User.GetClaim(JwtTypes.jti); var updated = await _userService.UpdateUserConfig(userConfig, Guid.Parse(userId)); await _userService.Commit(); }
public async Task <UserConfiguration> UpdateUserConfig(UpdateUserConfigViewModel userConfig, Guid userId) { var userConfiguration = await _unitOfWork.UserRepository.GetUserConfiguration(userId); userConfiguration.LogOutAfter = userConfig.LogOutAfter; userConfiguration.CommentsDisplayAmount = userConfig.CommentsDisplayAmount; userConfiguration.EventsDisplayAmount = userConfig.EventsDisplayAmount; userConfiguration.CalendarPastEvents = userConfig.CalendarPastEvents; userConfiguration.SendEmailNotification = userConfig.SendEmailNotification; userConfiguration.Anonymous = userConfig.Anonymous; return(userConfiguration); }
public async Task <IActionResult> UpdateUserConfig([FromBody] UpdateUserConfigViewModel userConfig) { try { await _accountFacade.UpdateUserConfig(userConfig); return(Ok()); } catch (Exception e) { Response.StatusCode = 500; return(Json(e.Message + e.InnerException)); } }