public JsonResult GetSlideByID(int id) { if (_session.IsLogin) { if (id == -1) { string jsonData = ""; jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(new Photo()); jsonData += "}"; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } else { string jsonData = ""; SlideBO _cls = new SlideBO(); var data = _cls.GetByID(id); jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(data); jsonData += "}"; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } } else { RedirectToAction("index", "admin"); } return(Json("[]", JsonRequestBehavior.AllowGet)); }
public ActionResult CreateSlide(int id) { ViewBag.ID = id; if (_session.IsLogin) { Slide model = new Slide(); ViewBag.Image = "~/Uploads/Default/default.png"; if (id != -1) { SlideBO cls = new SlideBO(); model = cls.GetByID(id); if (model == null) { model = new Slide(); } else { ViewBag.Image = model.Image; } return(View(model)); } else { return(View(model)); } } else { return(RedirectToAction("index", "admin")); } }
public JsonResult GetSlideByID(int id) { if (_session.IsLogin) { if (id == -1) { string jsonData = ""; jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(new Photo()); jsonData += "}"; return Json(jsonData, JsonRequestBehavior.AllowGet); } else { string jsonData = ""; SlideBO _cls = new SlideBO(); var data = _cls.GetByID(id); jsonData = "{\"master\":" + new JavaScriptSerializer().Serialize(data); jsonData += "}"; return Json(jsonData, JsonRequestBehavior.AllowGet); } } else RedirectToAction("index", "admin"); return Json("[]", JsonRequestBehavior.AllowGet); }
public ActionResult CreateSlide(int id) { ViewBag.ID = id; if (_session.IsLogin) { Slide model = new Slide(); ViewBag.Image = "~/Uploads/Default/default.png"; if (id != -1) { SlideBO cls = new SlideBO(); model = cls.GetByID(id); if (model == null) model = new Slide(); else ViewBag.Image = model.Image; return View(model); } else return View(model); } else return RedirectToAction("index", "admin"); }