public BANNER GetLogo() { var kq = new BANNER(); kq = db.BANNERs.SingleOrDefault(x => x.IS_DELETE == false && x.VITRI == 1); //if (kq == null) // kq.HINH = "\\Data\\slides\\logo-mobile.png"; return(kq); }
/// <summary> /// バナーの表示,非表示 /// </summary> public void ShowBanner(BANNER inBanner, bool inIsShow) { if (inIsShow) { banner[(int)inBanner].Show(); beforeBanner[(int)inBanner] = true; } else { banner[(int)inBanner].Hide(); beforeBanner[(int)inBanner] = false; } }
//lưu dữ liệu public int SaveData(BannerModel x, string user) { try { if (x.BANNER_ID > 0) { BANNER dao = db.BANNERs.SingleOrDefault(m => m.BANNER_ID == x.BANNER_ID); dao.HINH = x.HINH; dao.IS_DELETE = false; dao.MODIFILEDDATE = DateTime.Now.Date; dao.MODIFILEDBY = user; dao.LINK = x.LINK; dao.GHICHU_BANNER = x.GHICHU_BANNER; dao.CREATEBY = user; dao.TIEUDE = x.TIEUDE; dao.VITRI = x.VITRI; db.SaveChanges(); return(1); } else { BANNER dao = new BANNER(); dao.HINH = x.HINH; dao.IS_DELETE = false; dao.MODIFILEDDATE = DateTime.Now.Date; dao.MODIFILEDBY = user; dao.CREATEBY = x.CREATEBY; dao.TIEUDE = x.TIEUDE; dao.VITRI = x.VITRI; dao.LINK = x.LINK; dao.GHICHU_BANNER = x.GHICHU_BANNER; dao.CREATEDATE = DateTime.Now.Date; dao.CREATEBY = user; db.BANNERs.Add(dao); db.SaveChanges(); return(2); } } catch { return(0); } }
public IHttpActionResult AgregarBanner(BANNER model) { model.IdBanner = Guid.NewGuid(); try { db.BANNER.Add(model); db.SaveChanges(); } catch (Exception e) { return(Ok(new ResponseModel { Message = e.Message })); } return(Ok(new ResponseModel { Success = true, Message = "Registro Exitoso" })); }
public IHttpActionResult ActualizarBanner(BANNER model) { ResponseModelObj rmO = new ResponseModelObj(); try { var response = db.BANNER.Where(c => c.IdBanner == model.IdBanner).FirstOrDefault(); response.IMGBanner = model.IMGBanner; response.BannerFileName = model.BannerFileName; db.Entry(response).CurrentValues.SetValues(response); db.SaveChanges(); rmO.Success = true; rmO.Object = response; } catch (Exception e) { rmO.Message = e.Message; } return(Ok(rmO)); }
public int DoSaveData(BannerDataModel model) { BANNER saveModel; FileRepository fileRepository = new FileRepository(); if (model.ID == 0) { saveModel = new BANNER(); saveModel.BUD_ID = UserProvider.Instance.User.ID; saveModel.BUD_DT = DateTime.UtcNow.AddHours(8); } else { saveModel = this.DB.BANNER.Where(s => s.ID == model.ID).FirstOrDefault(); } saveModel.TITLE = model.Title; saveModel.SQ = model.Sort; saveModel.DISABLE = model.Disable; saveModel.UPT_ID = UserProvider.Instance.User.ID; saveModel.UPT_DT = DateTime.UtcNow.AddHours(8); PublicMethodRepository.FilterXss(saveModel); if (model.ID == 0) { this.DB.BANNER.Add(saveModel); } else { this.DB.Entry(saveModel).State = EntityState.Modified; } try { this.DB.SaveChanges(); } catch (Exception ex) { throw ex; } int identityId = (int)saveModel.ID; #region 檔案處理 FilesModel fileModel = new FilesModel() { ActionName = "Banner", ID = identityId, OldFileIds = model.OldFilesId }; fileRepository.UploadFile("Post", fileModel, model.Files, "M"); fileRepository.SaveFileToDB(fileModel); #endregion 檔案處理 return(identityId); }