Exemple #1
0
        public ActionResult Edit(int id)
        {
            var service = CreateMovieService();
            var detail  = service.GetMovieById(id);
            var model   =
                new MovieEdit
            {
                MovieID   = detail.MovieID,
                MovieName = detail.MovieName,
                Genre     = detail.Genre,
                Director  = detail.Director,
            };

            return(View(model));
        }
        public ActionResult Edit(int id)
        {
            var service = CreateMovieService();
            var detail  = service.GetMovieById(id);
            var model   =
                new MovieEdit
            {
                WatchedIt  = detail.WatchedIt,
                WatchLater = detail.WatchLater,
                WorthIt    = detail.WorthIt,
                Title      = detail.Title,
                Sequel     = detail.Sequel
            };

            return(View(model));
        }
Exemple #3
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.MovieId == model.MovieId /*&& e.OwnerId == _userId*/);

                entity.Title = model.Title;



                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #4
0
        //private MovieService CreateMovieService()
        //{
        //    var userId = Guid.Parse(User.Identity.GetUserId());
        //    var noteService = new NoteServices(userId);
        //    return noteService;
        //}

        public IHttpActionResult Put(MovieEdit movie)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateMovieService();

            if (!service.UpdateMovie(movie))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Exemple #5
0
        public ActionResult Edit(int id)
        {
            var service = CreateMovieService();
            var detail  = service.GetMovieById(id);
            var model   =
                new MovieEdit
            {
                MovieId     = detail.MovieId,
                MovieName   = detail.Title,
                Producer    = detail.Producer,
                Rating      = detail.Rating,
                Description = detail.Description,
            };

            return(View(model));
        }
Exemple #6
0
        public ActionResult Edit(int id)
        {
            var service = CreateMovieService();
            var detail  = service.GetMovieById(id);
            var model   = new MovieEdit
            {
                MovieId      = detail.MovieId,
                MovieName    = detail.MovieName,
                DirectorName = detail.DirectorName,
                Duration     = detail.Duration,
                GenreOfMovie = detail.GenreOfMovie,
                DateRelease  = detail.DateRelease
            };

            return(View(model));
        }
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .MovieReviews2
                    .Single(e => e.MovieID == model.MovieID && e.OwnerID == _userId);

                entity.MovieName   = model.MovieName;
                entity.Genre       = model.Genre;
                entity.Director    = model.Director;
                entity.ModifiedUtc = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
        public bool UpdateNote(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.MovieId == model.MovieId && e.CustomerID == _userId);

                entity.MovieName   = model.MovieName;
                entity.Producer    = model.Producer;
                entity.Rating      = model.Rating;
                entity.Description = model.Description;
                entity.ModifiedUtc = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #9
0
        // GET: Movie/Edit/5
        public ActionResult Edit(int id)
        {
            var service = CreateMovieService();
            var detail  = service.GetMovieById(id);
            var model   =
                new MovieEdit
            {
                MovieId      = detail.MovieId,
                Title        = detail.Title,
                ReleaseDate  = detail.ReleaseDate,
                Description  = detail.Description,
                CoverPicture = detail.CoverPicture,
                TrailerLink  = detail.TrailerLink,
                GenreName    = detail.GenreName
            };

            return(View(model));
        }
Exemple #10
0
        // GET: Edit Movie
        public ActionResult Edit(int?id)
        {
            MovieService service = new MovieService();
            MovieDetail  detail  = service.GetMovieById(id);

            MovieEdit movie = new MovieEdit()
            {
                Id                = detail.Id,
                PosterUrl         = detail.PosterUrl,
                Title             = detail.Title,
                Description       = detail.Description,
                ReleaseDate       = detail.ReleaseDate,
                Franchise         = detail.Franchise,
                AnticipationValue = detail.AnticipationValue
            };

            return(View(movie));
        }
Exemple #11
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.MovieId == model.MovieId && e.OwnerId == _userId);
                entity.MovieName    = model.MovieName;
                entity.DirectorName = model.DirectorName;
                entity.Duration     = model.Duration;
                entity.DateRelease  = model.DateRelease;
                entity.GenreOfMovie = model.GenreOfMovie;
                entity.ModifiedUtc  = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #12
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var movie = ctx
                            .Movies
                            .Single(m => m.Id == model.Id);

                movie.PosterUrl         = model.PosterUrl;
                movie.Title             = model.Title;
                movie.Description       = model.Description;
                movie.Genre             = model.Genre;
                movie.ReleaseDate       = model.ReleaseDate;
                movie.Franchise         = model.Franchise;
                movie.AnticipationValue = model.AnticipationValue;

                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Edit(int id)
        {
            var service = new MovieService();
            var deet    = service.GetMovieById(id);

            var model =
                new MovieEdit
            {
                MovieTitle       = deet.MovieTitle,
                MovieDescription = deet.MovieDescription,
                MovieRunTime     = deet.MovieRunTime,
                Director         = deet.Director,
                MovieRating      = deet.MovieRating,
                MovieGenre       = deet.MovieGenre,
                ReleaseYear      = deet.ReleaseYear,
            };

            return(View(model));
        }
        public ActionResult Edit(int ID)
        {
            var service = CreateMovieService();
            var detail  = service.GetMovieByID(ID);
            var model   =
                new MovieEdit
            {
                MovieID       = detail.MovieID,
                Title         = detail.Title,
                MainCast      = detail.MainCast,
                Description   = detail.Description,
                YearReleased  = detail.YearReleased,
                DateWatched   = detail.DateWatched,
                IsRecommended = detail.IsRecommended,
                ModifiedUtc   = DateTimeOffset.UtcNow
            };

            return(View(model));
        }
Exemple #15
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.MovieID == model.MovieID);    // && e.OwnerID == _userID);//This is Linq

                entity.Title         = model.Title;
                entity.MainCast      = model.MainCast;
                entity.Description   = model.Description;
                entity.YearReleased  = model.YearReleased;
                entity.DateWatched   = model.DateWatched;
                entity.IsRecommended = model.IsRecommended;
                entity.ModifiedUtc   = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #16
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var movie = new ApplicationDbContext())
            {
                var entity =
                    movie
                    .Movies
                    .Single(e => e.MovieId == model.MovieId && e.CreatorId == _creatorId);
                entity.Title    = model.Title;
                entity.Year     = model.Year;
                entity.Rated    = model.Rated;
                entity.Runtime  = model.Runtime;
                entity.Genre    = model.Genre;
                entity.Director = model.Director;
                entity.Actors   = model.Actors;
                entity.Plot     = model.Plot;

                return(movie.SaveChanges() == 1);
            }
        }
Exemple #17
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.MovieId == model.MovieId && e.OwnerId == _movieId);

                entity.MovieId   = model.MovieId;
                entity.Title     = model.Title;
                entity.WatchedIt = model.WatchedIt;
                //entity.WatchLater = model.WatchLater;
                entity.WorthIt     = model.WorthIt;
                entity.Sequel      = model.Sequel;
                entity.ModifiedUtc = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #18
0
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.Id == model.Id);

                entity.MovieTitle       = model.MovieTitle;
                entity.MovieDescription = model.MovieDescription;
                entity.MovieRunTime     = model.MovieRunTime;
                entity.Director         = model.Director;
                entity.MovieRating      = model.MovieRating;
                entity.MovieGenre       = model.MovieGenre;
                entity.ReleaseYear      = model.ReleaseYear;

                return(ctx.SaveChanges() == 1);
            }
        }
        public bool UpdateMovie(MovieEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Movies
                    .Single(e => e.MovieId == model.MovieId && e.UserId == _userId);

                entity.MovieId      = model.MovieId;
                entity.Title        = model.Title;
                entity.ReleaseDate  = model.ReleaseDate;
                entity.Description  = model.Description;
                entity.CoverPicture = model.CoverPicture;
                entity.TrailerLink  = model.TrailerLink;
                entity.GenreName    = model.GenreName;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #20
0
        public ActionResult Edit(int id, MovieEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model.MovieId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
            }
            var service = CreateMovieService();

            if (service.UpdateMovie(model))
            {
                TempData["SaveResult"] = "Your Movie was updated";
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Movie could not be updated");
            return(View());
        }
Exemple #21
0
        public ActionResult Edit(int id, MovieEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.MovieId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = CreateMovieService();

            if (service.UpdateMovie(model))
            {
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Exemple #22
0
        public ActionResult Edit(int id, MovieEdit model)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Could not update movie, try again later");
                return(View(model));
            }

            if (model.Id != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
            }

            MovieService service = new MovieService();

            if (service.UpdateMovie(model))
            {
                return(RedirectToAction("AllMovies"));
            }

            ModelState.AddModelError("", "Could not update movie, try again later");
            return(View(model));
        }
Exemple #23
0
 public MovieEditView(MovieEdit movieEdit) : base(movieEdit)
 {
 }