public ActionResult Update(int id) { int uid = Convert.ToInt32(AuthenticationManager.User.FindFirst(ClaimTypes.Sid).Value); var _theme = themeService.FindbyUser(uid); var ThemeList = TempData["Theme"] as ICollection <Theme>; if (ThemeList == null) { return(Fail()); } var theme = ThemeList.FirstOrDefault(t => t.Id == id); if (_theme != null) { if (_theme.Id != id) { _theme.Name = theme.Name; _theme.Directory = theme.Directory; _theme.SetTime = DateTime.Now; if (themeService.Update(theme)) { return(Success()); } } else { return(Success("没有修改")); } } theme.Id = 0; theme.SetTime = DateTime.Now; theme.UserID = uid; theme = themeService.Add(theme); if (theme.Id > 0) { return(Success()); } return(Fail()); }