public ActionResult InsertOrUpdate(int?id = null) { var viewModel = new AlbumViewModel(id); viewModel.Prepare(); return(View(viewModel)); }
public ActionResult InsertOrUpdate(AlbumViewModel model) { if (!ModelState.IsValid) { model.Prepare(); return(View(model)); } model.Save(); return(RedirectToAction("List")); }