public ActionResult Delete(int id, int?bookId)
        {
            SimilarUrl category = db.SimilarUrls.Find(id);

            db.SimilarUrls.Remove(category);
            TempData["message"] = "The comment has been deleted!";
            db.SaveChanges();
            return(RedirectToAction("../Bookmark/Show", new { id = bookId }));
        }
Пример #2
0
 public ActionResult AddUrl(Bookmark bookmark)
 {
     try
     {
         SimilarUrl url = new SimilarUrl();
         url.BookmarkId = bookmark.Id;
         System.Diagnostics.Debug.WriteLine(bookmark.Comment);
         url.UrlBody = bookmark.Url;
         url.UserId  = User.Identity.GetUserId();
         url.Date    = bookmark.SimilarUrlDate;
         db.SimilarUrls.Add(url);
         db.SaveChanges();
         TempData["message"] = "Your related url has been added";
         return(RedirectToAction("Show", new { id = bookmark.Id }));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Show", new { id = bookmark.Id }));
     }
 }