public ActionResult Create(CreateMovieViewModel movie) { if (!ModelState.IsValid) { return(View(movie)); } foreach (var item in movie.DoubanID.Split('\n')) { if (item.Trim().Length == 0) { continue; } JObject json = HtmlDecoder.GetJson("https://api.douban.com/v2/movie/subject/" + item.Replace("https://movie.douban.com/subject/", "").Replace("/", "")); JToken msg; if (json.TryGetValue("msg", out msg)) { ModelState.AddModelError("", string.Format("{0} {1} {2}", "添加编号为", item, "的电影 失败")); } else { ModelState.AddModelError("", string.Format("{0} {1} {2}", "添加编号为", item, "的电影 成功")); MovieManager.CreateJson(json, Server.MapPath("~/Content/Movie/"), AccountManager.GetId(CookieHepler.GetCookie("user"))); } } return(View()); }