public ActionResult AddOrUpdate(Banner_Logo model, HttpPostedFileBase file) { var exist = this.BannerService.GetOneByLINQ(c => c.ID.Equals(model.ID)); model.Position = 0; model.Type = 0; if (exist != null && model.ID == 0) { return Content("exist"); } if (PathUpload == "" || PathUpload == null) { model.Image = exist.Image; } else { model.Image = PathUpload; } var id = this.BannerService.Save(model); PathUpload = ""; var data = this.BannerService.GetByID(id); SessionManagement.SetSesionValue("BannerID", id.ToString()); return Json(data, JsonRequestBehavior.AllowGet); }
public ActionResult _AddOrUpdate(int id) { var data = BannerService.GetByID(id); if (data == null) data = new Banner_Logo(); data.ListCategoryExt = BannerService.GetListCategory((int.Parse(data.ProductCateID.ToString()))); int position = (int)Enum.Parse(typeof(ValueDefine.BannerLogoPosition), Enum.GetName(typeof(ValueDefine.BannerLogoPosition), data.Position)); data.ListPositionExt = BannerService.GetListPosition(position); int type = (int)Enum.Parse(typeof(ValueDefine.BannerLogoType), Enum.GetName(typeof(ValueDefine.BannerLogoType), data.Type)); data.ListTypeExt = BannerService.GetListType(type); return PartialView(data); }