public IActionResult SubmitEditMovie(addMovie editMovie)
        {
            IQueryable <addMovie> edit_movie = Context.Movies1.Where(m => m.MovieID == editMovie.MovieID);

            if (ModelState.IsValid)
            {
                foreach (var x in edit_movie)
                {
                    x.Title         = editMovie.Title;
                    x.Category      = editMovie.Category;
                    x.Year          = editMovie.Year;
                    x.DirectorFName = editMovie.DirectorFName;
                    x.DirectorLName = editMovie.DirectorLName;
                    x.Rating        = editMovie.Rating;
                    x.Edited        = editMovie.Edited;
                    x.LentTo        = editMovie.LentTo;
                    x.Notes         = editMovie.Notes;
                }
            }


            Context.Movies1.Update(editMovie);
            Context.SaveChanges();
            return(RedirectToAction("ViewMovies"));
        }
 public IActionResult AddMovies(addMovie submittedForm)
 {
     if (ModelState.IsValid)
     {
         Context.Movies1.Add(submittedForm);
         Context.SaveChanges();
         return(View("Index"));
     }
     else
     {
         return(View());
     }
 }
        public IActionResult EditMovie(long Hello)
        {
            addMovie removingMovie = Context.Movies1.Where(m => m.MovieID == Hello).FirstOrDefault();

            return(View(removingMovie));
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            addMovie movieWindow = new addMovie();

            movieWindow.ShowDialog();
        }