public ActionResult CreateDiscografica(Discografica discografica) { if (ModelState.IsValid) { var context = new DiscosEntities(); context.Discograficas.Add(discografica); context.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create(Discografica model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } repo.Add(model); repo.Save(); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(Discografica model) { try { // TODO: Add update logic here if (!ModelState.IsValid) { return(BadRequest(ModelState)); } repo.Update(model); repo.Save(); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }