public ActionResult Create(Movie movie) { if (!ModelState.IsValid) return View(); _documentSession.Store(movie); TempData["Message"] = string.Format("Created Movie {0}", movie.Title); return RedirectToAction("Index"); }
public void CreateAction_PassesModelValidation_RedirectsToIndexActionSettingMessage() { var movie = new Movie().NewValid(); var homeController = new HomeController(_documentSession); homeController.Create(movie); Assert.That(homeController.TempData["message"], Is.EqualTo(string.Format("Created Movie {0}", movie.Title))); }
public static Movie SaveNewMovieToRavenDB(this IDocumentSession documentSession, Movie movie) { documentSession.Store(movie); documentSession.SaveChanges(); return movie; }