public HttpResponseMessage SwitchLanguage(SwitchLanguageDTO dto) { if (UserController.GetCurrentUserInfo().IsSuperUser) { try { if ((!string.IsNullOrEmpty(dto.Language))) { var personalizationController = new DotNetNuke.Services.Personalization.PersonalizationController(); var personalization = personalizationController.LoadProfile(UserInfo.UserID, PortalSettings.PortalId); personalization.Profile["Usability:UICulture"] = dto.Language; personalization.IsModified = true; personalizationController.SaveProfile(personalization); return(Request.CreateResponse(HttpStatusCode.OK)); } } catch (System.Threading.ThreadAbortException) { //Do nothing we are not logging ThreadAbortxceptions caused by redirects } catch (Exception ex) { Exceptions.LogException(ex); } } return(Request.CreateResponse(HttpStatusCode.InternalServerError)); }
public HttpResponseMessage SwitchLanguage(SwitchLanguageDTO dto) { if (UserController.GetCurrentUserInfo().IsSuperUser) { try { if ((!string.IsNullOrEmpty(dto.Language))) { var personalizationController = new DotNetNuke.Services.Personalization.PersonalizationController(); var personalization = personalizationController.LoadProfile(UserInfo.UserID, PortalSettings.PortalId); personalization.Profile["Usability:UICulture"] = dto.Language; personalization.IsModified = true; personalizationController.SaveProfile(personalization); return Request.CreateResponse(HttpStatusCode.OK); } } catch (System.Threading.ThreadAbortException) { //Do nothing we are not logging ThreadAbortxceptions caused by redirects } catch (Exception ex) { Exceptions.LogException(ex); } } return Request.CreateResponse(HttpStatusCode.InternalServerError); }