예제 #1
0
        public ActionResult CreateMovie(AllMoviesModel model)
        {
            if (ModelState.IsValid)
            {
                this.db.Movies.Add(new Movie
                {
                    Title                    = model.Title,
                    Director                 = model.Director,
                    Year                     = model.Year,
                    LeadingMaleRoleActor     = model.LeadingMaleRoleActor,
                    ActorAge                 = model.ActorAge,
                    LeadingFemaleRoleActress = model.LeadingFemaleRoleActress,
                    ActressAge               = model.ActressAge,
                    Studio                   = model.Studio,
                    StudioAddress            = model.StudioAddress
                });

                this.db.SaveChanges();

                TempData["Success"] = "You have successfully created new movie";

                return(RedirectToAction("CreateMovie"));
            }

            return(View("CreateMovie", model));
        }
예제 #2
0
        public ActionResult CreateMovie(AllMoviesModel model)
        {
            if (ModelState.IsValid)
            {
                this.db.Movies.Add(new Movie
                {
                    Title = model.Title,
                    Director = model.Director,
                    Year = model.Year,
                    LeadingMaleRoleActor = model.LeadingMaleRoleActor,
                    ActorAge = model.ActorAge,
                    LeadingFemaleRoleActress = model.LeadingFemaleRoleActress,
                    ActressAge = model.ActressAge,
                    Studio = model.Studio,
                    StudioAddress = model.StudioAddress
                });

                this.db.SaveChanges();

                TempData["Success"] = "You have successfully created new movie";

                return RedirectToAction("CreateMovie");
            }

            return View("CreateMovie", model);
        }