public ActionResult Edit([Bind(Include = "Profile, MoviesToAdd, AllMovies, AllJobs")] ProfileMoviesJobsViewModel model) { if (ModelState.IsValid) { ProfileDb.UpdateProfile(db, model.Profile, model.MoviesToAdd); return(RedirectToAction("Index")); } return(View(model)); }
// GET: Profiles/Create public ActionResult Create() { ProfileMoviesJobsViewModel model = new ProfileMoviesJobsViewModel { AllMovies = MovieDb.GetAllMovies(db), AllJobs = JobDb.GetAllJobs(db) }; return(View(model)); }
// GET: Profiles/Edit/5 public ActionResult Edit(int?id) { if (!id.HasValue) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Profile profile = ProfileDb.FindProfile(db, id.Value); if (profile == null) { return(HttpNotFound()); } ProfileMoviesJobsViewModel model = new ProfileMoviesJobsViewModel { Profile = profile, AllMovies = MovieDb.GetAllMovies(db), AllJobs = JobDb.GetAllJobs(db) }; return(View(model)); }