public ActionResult ArtistReviewDeleteConfirmed(int id) { ArtistReview review = db.ArtistReviews.Find(id); db.ArtistReviews.Remove(review); db.SaveChanges(); return(RedirectToAction("Index", "Artists")); }
public ActionResult Edit([Bind(Include = "ArtistReviewID,Rating,Comment")] ArtistReview artistReview) { if (ModelState.IsValid) { db.Entry(artistReview).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artistReview)); }
public ActionResult ArtistReviewDelete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArtistReview review = db.ArtistReviews.Find(id); if (review == null) { return(HttpNotFound()); } return(View(review)); }
public ActionResult CreateArtistReview([Bind(Include = "ArtistReviewId, ArtistScore, ArtistReviewText, ArtistReviewAuthor")] ArtistReview review, Int32 artistID) { Artist artist = db.Artists.Find(artistID); AppUser author = db.Users.Find(User.Identity.GetUserId()); review.ReviewedArtist = artist; review.ArtistReviewAuthor = author; if (ModelState.IsValid) { db.ArtistReviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index", "Artists")); } return(View(review)); }
public ActionResult Create([Bind(Include = "ArtistReviewID,Rating,Comment")] ArtistReview artistReview, string UserID, Int32 ArtistID) { if (ModelState.IsValid) { artistReview.Artist = db.Artists.Find(ArtistID); List <AppUser> theseUsers = new List <AppUser>(); theseUsers = db.Users.Where(a => a.UserName.Contains(UserID)).ToList(); int i = 0; artistReview.User = theseUsers[0]; db.ArtistReviews.Add(artistReview); db.SaveChanges(); return(RedirectToAction("Index", "Artists")); } return(View(artistReview)); }