public ActionResult Create(Catlog Cat) { if (ModelState.IsValid) { try { dc.CatLogs.Add(Cat); dc.SaveChanges(); return RedirectToAction("Index"); } catch { return View(Cat); } } else return View(Cat); }
public ActionResult Edit( Catlog cat) { if (ModelState.IsValid) { try { dc.Entry(cat).State = EntityState.Modified; dc.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } } else return View(cat); }