Beispiel #1
0
        public ActionResult CommentDeleteConfirmed(int id)
        {
            FilmComment filmComment = db.FilmComments.Find(id);

            db.FilmComments.Remove(filmComment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 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));
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        // 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));
        }
Beispiel #6
0
        // 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));
        }
Beispiel #7
0
        public void Delete(FilmComment entity)
        {
            FilmComment comment = Context.FilmComments.First(x => x.Id == entity.Id);

            Context.FilmComments.Remove(comment);
        }
Beispiel #8
0
        public void Update(FilmComment entity)
        {
            FilmComment comment = Context.FilmComments.First(x => x.Id == entity.Id);

            comment.Comment = entity.Comment;
        }
Beispiel #9
0
 public void Insert(FilmComment entity)
 {
     Context.FilmComments.Add(entity);
 }