コード例 #1
0
        public ActionResult EditActor(string firstName, string lastName, DateTime dob, int id, bool gender)
        {
            var model = new ActorViewModel()
            {
                FirstName = firstName,
                LastName = lastName,
                DOB = dob,
                IsFemale = gender,
                Id = id
            };

            return this.PartialView("_PartialEditActor", model);
        }
コード例 #2
0
        public ActionResult AddActor(ActorViewModel model)
        {
            if (ModelState.IsValid)
            {
                this.actorsRepo.Add(new Actor()
                {
                    FirstName = model.FirstName,
                    LastName = model.LastName,
                    DOB = model.DOB,
                    IsFemale = model.IsFemale
                });
                this.actorsRepo.SaveChanges();
                return this.Redirect("/Actors");
            }

            else
            {
                return this.PartialView("Error");
            }
        }