public ActionResult Create(genreModel genre1) { try { if (ModelState.IsValid) { db.genres.Add(genre1); db.SaveChanges(); return RedirectToAction("Index"); } else { return View(); } } catch { return View(); } }
public ActionResult Edit(int id, genreModel genre2) { try { if (genre2 == null) { return HttpNotFound(); } else if (ModelState.IsValid) { db.Entry(genre2).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } else { return View(); } } catch { return View(); } }