public ActionResult Index(GenreEditModel model) { if (ModelState.IsValid) return RedirectToAction("Index"); return View(model); }
public ActionResult Create() { var model = new GenreEditModel { StartDate = DateTime.Now.AddDays(2), DateToCompareAgainst = DateTime.Now }; return View(model); }
public ActionResult Index(GenreEditModel model) { Thread.Sleep(10000); throw new Exception("exception"); if (ModelState.IsValid) { return PartialView("Thanks"); } return PartialView("_Create"); }
public ActionResult Create(GenreEditModel model) { if (ModelState.IsValid) return RedirectToAction("Index"); var genre = new Genre { Name = model.Name, Description = model.Description }; _genreService.Add(genre); return View(model); }
public ActionResult Edit(int id = 0) { var genre = _genreService.GetGenre(id); if (genre == null) return HttpNotFound(); var model = new GenreEditModel() { Id = genre.Id, Name = genre.Name, Description = genre.Description }; return View("Create", model); }