public ActionResult Edit(int id = 0, string error = "") { Banner banner = new Banner(); banner.ID = id; if (id > 0) { banner.Get(); } if (TempData["banner"] != null) { try { banner = (Banner)TempData["banner"]; } catch (Exception) { } } ViewBag.banner = banner; ViewBag.banner_count = banner.GetAll().Count; ViewBag.error = error; return View(); }