public ActionResult Create(ArtistaViewModel viewModel) { if (ModelState.IsValid) { var artistaCrear = new Artista(viewModel, db); new Repositorio <Artista>(db).Crear(artistaCrear); return(RedirectToAction("Index")); } viewModel.RegenerarVista(db); return(View(viewModel)); }
public ActionResult Edit(ArtistaViewModel viewModel) { if (ModelState.IsValid) { Artista artista = new Repositorio <Artista>(db).Traer(viewModel.Id); artista.Modificar(viewModel, db); new Repositorio <Artista>(db).Modificar(artista); return(RedirectToAction("Index")); } viewModel.RegenerarVista(db); return(View(viewModel)); }
public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Artista artistaModificar = new Repositorio <Artista>(db).Traer(id.Value); if (artistaModificar == null) { return(HttpNotFound()); } var artistaViewModel = new ArtistaViewModel(artistaModificar, db); artistaViewModel.RegenerarVista(db); return(View(artistaViewModel)); }