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)); }
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); }