public JsonResult Add(int novelId = 0) { string userName = currentUser.UserName; int result = (int)ErrorMessage.失败; if (string.IsNullOrEmpty(userName)) { result = (int)ErrorMessage.用户名为空; } else if (_bookmarkService.Exists(novelId, userName)) { result = (int)ErrorMessage.已收藏; } else { Bookmark bookmark = new Bookmark(); bookmark = GetClientLogInfo(bookmark) as Bookmark; bookmark.UserName = userName; bookmark.NovelId = novelId; bookmark.ChapterId = 0; bookmark.ChapterCode = 0; bookmark.Position = 0; bookmark.RecentReadTime = System.DateTime.Now; BookmarkLogView bookmarkLogView = new BookmarkLogView(); bookmarkLogView = GetLogInfo(bookmarkLogView) as BookmarkLogView; bookmarkLogView.HistoryCount = 100; result = _bookmarkService.Add(bookmark, bookmarkLogView); } return(Json(new ComplexResponse <string>(result))); }
public ActionResult Create(Bookmark bookmark) { bookmark.DateCreated = DateTime.UtcNow; _bookmarkService.Add(bookmark); return(RedirectToAction("Index")); }