public ActionResult CommentDeleteConfirmed(int id) { FilmComment filmComment = db.FilmComments.Find(id); db.FilmComments.Remove(filmComment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult CommentEdit([Bind(Include = "FilmCommentId,FilmId,Comment,User")] FilmComment filmComment) { if (ModelState.IsValid) { db.Entry(filmComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FilmId = new SelectList(db.Films, "FilmId", "FilmImage", filmComment.FilmId); return(View(filmComment)); }
public async Task <bool> SetComment(FilmComment filmComment) { if (!await _movieService.ExistMovieOnDb(filmComment.FilmId)) { Movie movie = await _movieService.GetMovieById(filmComment.FilmId); await _movieService.InsertMovie(movie); } return(await _repository.SetFilmComment(filmComment)); }
public ActionResult CommentCreate([Bind(Include = "FilmCommentId,FilmId,Comment,User")] FilmComment filmComment) { if (ModelState.IsValid) { db.FilmComments.Add(filmComment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FilmId = new SelectList(db.Films, "FilmId", "FilmImage", filmComment.FilmId); return(View(filmComment)); }
// GET: FilmComments/Delete/5 public ActionResult CommentDelete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FilmComment filmComment = db.FilmComments.Find(id); if (filmComment == null) { return(HttpNotFound()); } return(View(filmComment)); }
// GET: FilmComments/Edit/5 public ActionResult CommentEdit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FilmComment filmComment = db.FilmComments.Find(id); if (filmComment == null) { return(HttpNotFound()); } ViewBag.FilmId = new SelectList(db.Films, "FilmId", "FilmImage", filmComment.FilmId); return(View(filmComment)); }
public void Delete(FilmComment entity) { FilmComment comment = Context.FilmComments.First(x => x.Id == entity.Id); Context.FilmComments.Remove(comment); }
public void Update(FilmComment entity) { FilmComment comment = Context.FilmComments.First(x => x.Id == entity.Id); comment.Comment = entity.Comment; }
public void Insert(FilmComment entity) { Context.FilmComments.Add(entity); }