コード例 #1
0
 public ActionResult DeleteReview(int bid, int uid)
 {
     if (ReviewCRUD.RemoveReview(bid, uid))
     {
         return(Content("<script>alert('Review Deleted Successfully.');window.location.href=document.referrer;</script>"));
     }
     else
     {
         return(Content("<script>alert('Operation Failed.');window.location.href=document.referrer</script>"));
     }
 }
コード例 #2
0
        public ActionResult ReviewBook(FormCollection collection)
        {
            Review newReview = new Review();

            newReview.UserID      = (int)Session["UserID"];
            newReview.UserName    = (string)Session["UserName"];
            newReview.BookID      = Int32.Parse(collection["BookID"]);
            newReview.Description = collection["ReviewText"];
            newReview.Rating      = 6 - Int32.Parse(collection["review-rating"]);

            if (ReviewCRUD.CreateReview(newReview))
            {
                return(Content("<script>alert('Review has been added Successfully.');window.location.href=document.referrer;</script>"));
            }
            else
            {
                return(Content("<script>alert('Review Failed.');window.location.href=document.referrer;</script>"));
            }
        }