示例#1
0
        public PartialViewResult CreateActorPartialView()
        {
            ActorsViewModels actor = new ActorsViewModels();
            Movie            movie = new Movie();

            ViewBag.ProID = new SelectList(db.Producers, "ProID", "Name", movie.ProID);
            ViewBag.Sex   = new SelectList(MoviesController.GetGender(), "Value", "Text", actor.Sex);
            return(PartialView("CreateActorPartialView"));
        }
示例#2
0
        //,ActionName("CreateActor")
        public ActionResult CreateActorPartialView(ActorsViewModels actorModel)
        {
            if (ModelState.IsValid)
            {
                Actor actor = new Actor();
                actor.Name        = actorModel.Name;
                actor.Sex         = (byte)actorModel.Sex;
                actor.Bio         = actorModel.Bio;
                actor.DOB         = actorModel.DOB;
                actor.MovieActors = actorModel.MovieActors;
                db.Actors.Add(actor);
                db.SaveChanges();

                return(Content("Actor Added Successfully"));
            }
            ViewBag.Sex = new SelectList(MoviesController.GetGender(), "Value", "Text", actorModel.Sex);
            return(PartialView(actorModel));
        }