public ActionResult Index(int page = 1) { var userEmail = Convert.ToString(HttpContext.Request.Cookies["Email"].Value); var user = Repository.Users.FirstOrDefault(p => p.Email == userEmail); var bookmarkView = new BookmarkView(); bookmarkView.UserId = user.ID; ViewBag.ID = bookmarkView.UserId; var data = new PageableData<Bookmarks>(Repository.Bookmark.OrderBy(p => p.UserID).Where(x => x.UserID == bookmarkView.UserId), page, 12); return View(data); }
public ActionResult Add(BookmarkView bookmarkView) { if (ModelState.IsValid) { var userEmail = Convert.ToString(HttpContext.Request.Cookies["Email"].Value); var user = Repository.Users.FirstOrDefault(p => p.Email == userEmail); bookmarkView.UserId = user.ID; var bookmark = (Bookmarks)ModelMapper.Map(bookmarkView, typeof(BookmarkView), typeof(Bookmarks)); Repository.CreateBookmark(bookmark); return RedirectToAction("Index"); } return View(bookmarkView); }
public ActionResult Del() { var newBookmarkView = new BookmarkView(); return View(newBookmarkView); }