public ServiceResult ChangeLanguage(ChangeLanguageModel im) { var result = new ServiceResult(); if (!ModelState.IsValid) { result.Code = ReasonCode.MISSING_REQUIRED_FIELDS; foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage))) { result.Message += error + Environment.NewLine; } return(result); } if (im.Language.Contains("en") || im.Language.Contains("zh")) { new UserAccountComponent().ChangeLanguagetoDb(this.GetUser().Id, im.Language); } result.Success(); return(result); }