public IHttpActionResult UpdateProfile([FromBody] string clientProfile) { if (string.IsNullOrEmpty(this.User.Identity.Name)) { return(this.Ok()); } dynamic obj = JsonConvert.DeserializeObject(clientProfile); var clientUser = ProfileHelper.GetClientUser(this.User.Identity.Name); clientUser.UserFilter = FilterFromPost(obj.company); clientUser.CompetitorFilter.Clear(); foreach (var item in obj.competitors) { if (item.name == "" || item.filters.Count == 0) { continue; } var filter = FilterFromPost(item); clientUser.CompetitorFilter.Add(filter); } clientUser.UserFilter.UserName = this.User.Identity.Name;//公司名称不能被修改 if (this.IsValidFilter(clientUser) || IsValidCompetitorFilter(clientUser)) { ProfileHelper.UpdateClientUser(clientUser); clientUser = ProfileHelper.GetClientUser(this.User.Identity.Name); BackgroundJob.Enqueue(() => TaskProcessor.InitDataFast(clientUser)); } return(this.Ok(clientUser)); }