public ActionResult AddArtist(ArtistModel model) { if (ModelState.IsValid) { try { Artist artist = new Artist(); artist.ArtistId = model.yearDropDownId; artist.ArtistFirstName = model.FirstName; artist.ArtistLastName = model.LastName; dataService.ArtistService.AddNew(artist); ViewBag.ThankYou = model.FirstName + " " + model.LastName + " has been successfully added."; return View("ThankYou"); } catch (Exception e) { ViewBag.ErrorMessage = e.InnerException; return View("Error"); } } else { ViewBag.ErrorMessage = "Invalid Model State"; return View("Error"); } }
public ActionResult AddArtist() { ArtistModel artist = new ArtistModel(); artist.yearDropDown = dataService.YearPublishedService.YearList(); return View(artist); }