/// <summary> /// 保存轮播图 /// </summary> /// <param name="model">信息体</param> /// <returns></returns> public bool SubmitModule(BannerEntity model) { //保存失败 if (model == null) { return(false); } if (!string.IsNullOrEmpty(model.ComClassSid)) { ComClassEntity comEntity = _comService.GetSingle(model.ComClassSid); model.ComClass = comEntity == null ? String.Empty : comEntity.Title; } if (!string.IsNullOrEmpty(model.Sid) && model.Sid.Length > 32) { BannerEntity moduleEntity = _service.GetSingle(model.Sid); if (moduleEntity != null) { model.CreateDate = moduleEntity.CreateDate; model.EditDate = DateTime.Now; model.IsDelete = moduleEntity.IsDelete; } } _service.SaveFrom(model); return(true); }
public List <BannerEntity> ConsultaTodosBanners() { List <BannerEntity> lstBanners = new List <BannerEntity>(); using (var context = new CirculoNegocioEntities()) { var ret = context.tbBanners.Join(context.tbClientes, b => b.idCliente, c => c.id, (b, c) => new { b.id, b.idCliente, c.nome, b.Ativo, b.dataAte, b.dataDe, b.DataUltimaAlteracao, b.estado, b.idTipoBanner, b.imagemFilePath, b.responsavelUltimaAlteracao }).ToList(); foreach (var item in ret) { BannerEntity obj = new BannerEntity(); obj.id = item.id; obj.Ativo = item.Ativo; obj.dataAte = item.dataAte; obj.dataDe = item.dataDe; obj.estado = item.estado; obj.idCliente = item.idCliente; obj.nomeCliente = item.nome; obj.idTipoBanner = item.idTipoBanner; obj.imagemFilePath = item.imagemFilePath; obj.responsavelUltimaAlteracao = item.responsavelUltimaAlteracao; obj.DataUltimaAlteracao = item.DataUltimaAlteracao; lstBanners.Add(obj); } } return(lstBanners); }
public void GetBook_WithNonExistingId_ReturnsNull() { BannerEntity banner = new BannerEntity(EBannerType.DEPARTAMENT, "Açougue", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner.SetSubtitle("Carnes fresquinhas"); banner.SetDescription("Carnes fresquinhas"); banner.SetTipText("Açougue"); banner.SetUrlNavigate("/"); _context.Banners.Add(banner); _context.SaveChanges(); var ok = _context.Banners.Where(a => a.Id > 0).FirstOrDefault(); _repository.Add(banner); var ba = _repository.Query(a => a.Id > 0).ToList(); Assert.IsTrue(banner.Id > 0); //// Arrange //const int nonExistingId = 155; //// Act //var book = _repository.Get(nonExistingId); //// Assert //book.Should().BeNull(); }
private void CheckLatestServerCampaignVersionsAsync(Action <BannerEntity> completedAction) { Task.Factory.StartNew(() => { try { if (this.serviceInstance.ShouldShowDefaultBanners()) { this.DeleteAllBannerCampaignVersions(); } else { BannerEntity result = this.serviceInstance.GetLatestCampaign(); completedAction(result); } } catch (EndpointNotFoundException) { } catch (TimeoutException) { } catch (CommunicationException) { } catch (Exception ex) { Configuration.Analytics.TrackException(ex); } }); }
public async Task <IActionResult> Edit(int id, [Bind("Id,EntityId")] BannerEntity bannerEntity) { if (id != bannerEntity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bannerEntity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BannerEntityExists(bannerEntity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EntityId"] = new SelectList(_context.EntitiesBase, "Id", "Id", bannerEntity.EntityId); return(View(bannerEntity)); }
private void OnCheckLatestServerCampaignVersionsAsync(BannerEntity bannerEntity) { if (bannerEntity == null) { return; } if (currentBannerCampaignVersion == null) { this.DownloadBannerEntityPackage(bannerEntity); } else { Version serverVersion; if (Version.TryParse(bannerEntity.Version, out serverVersion)) { if (currentBannerCampaignVersion < serverVersion) { this.DownloadBannerEntityPackage(bannerEntity); } else if (currentBannerCampaignVersion == serverVersion) { UpdateBannersConfigsByNewVersion(currentBannerCampaignVersion.ToString()); } } } }
public bool Post(BannerModel model) { var entity = new BannerEntity { Title = model.Title, ImgUrl = model.ImgUrl, Order = model.Order, Adduser = model.Adduser, Addtime = model.Addtime, Upduser = model.Upduser, Updtime = model.Updtime, // Content = model.Content, }; if (_BannerService.Create(entity).Id > 0) { return(true); } return(false); }
public ActionResult Create(FormCollection formCollection, BannerViewModel vo) { if (ModelState.IsValid) { var entity = new BannerEntity(); entity.CreatedUser = base.CurrentUser.CustomerId; entity.UpdatedUser = base.CurrentUser.CustomerId; entity.CreatedDate = DateTime.Now; entity.UpdatedDate = DateTime.Now; entity.SourceId = vo.SourceId; entity.SourceType = (int)SourceType.Promotion; entity.SortOrder = vo.SortOrder; entity.Status = (int)DataStatus.Default; using (TransactionScope ts = new TransactionScope()) { entity = this._bannerRepo.Insert(entity); var ids = _resourceSer.Save(ControllerContext.HttpContext.Request.Files , CurrentUser.CustomerId , -1, entity.Id , SourceType.BannerPromotion); ts.Complete(); } return(RedirectToAction("Edit", new { id = entity.Id })); } return(View(vo)); }
public void Insert(Banner entity) { var dbEntity = new BannerEntity { Html = entity.Html, Modified = entity.Modified, Created = entity.Created }; _collection.InsertOne(dbEntity); }
private void DownloadBannerEntityPackage(BannerEntity bannerEntity) { string localBannerPackageName = Path.Combine(localBannersDirInfo.FullName, Path.GetFileName(bannerEntity.DownloadUri)); WebClient webClient = new WebClient(); webClient.DownloadFileCompleted += OnDownloadBannerEntityPackageCompleted; webClient.DownloadFileAsync(new Uri(bannerEntity.DownloadUri, UriKind.RelativeOrAbsolute), localBannerPackageName, localBannerPackageName); }
public ActionResult SubmitForm(BannerEntity bannerEntity) { bool result = bannerApp.SubmitModule(bannerEntity); if (result) { return(Success("保存成功。。。")); } return(Error("保存失败。。。")); }
public ActionResult GetBanner() { Pagination pagination = new Pagination(); pagination.rows = 6; pagination.page = 1; BannerEntity para = new BannerEntity(); var pageList = BannerBLL.Instance.GetPageList(null, ref pagination); return(Content(pageList.ToJson())); }
//Inclui banner comum protected void btnIncluir_Click(object sender, EventArgs e) { BannerEntity banner = new BannerEntity(); bool? ativo; banner.idCliente = Convert.ToInt32(ddlCliente.SelectedValue); banner.idTipoBanner = Convert.ToInt32(ddlTipoBanner.SelectedValue); ativo = rdlAtivo.SelectedValue == "1" ? true : false; banner.Ativo = ativo; banner.dataAte = Convert.ToDateTime(Convert.ToDateTime(txtDataHoraFinal.Text).ToString("s")); banner.dataDe = Convert.ToDateTime(Convert.ToDateTime(txtDataHoraInicial.Text).ToString("s")); banner.estado = ddlEstado.SelectedValue; banner.responsavelUltimaAlteracao = Membership.GetUser().UserName; banner.DataUltimaAlteracao = DateTime.Now; int idBanner = bannerBusiness.InsereBanner(banner); if (FileUpImagensBanner.HasFile) { if (!Directory.Exists(Server.MapPath(@"~/Banners/" + idBanner))) { Directory.CreateDirectory(Server.MapPath(@"~/Banners/" + idBanner)); } else { Directory.Delete(Server.MapPath(@"~/Banners/" + idBanner)); Directory.CreateDirectory(Server.MapPath(@"~/Banners/" + idBanner)); } string caminhoArquivo = Server.MapPath(@"~/Banners/" + idBanner) + @"\" + FileUpImagensBanner.FileName; FileUpImagensBanner.SaveAs(caminhoArquivo); bannerBusiness.AtualizaFilePathImagemBanner(idBanner, caminhoArquivo); } else { bannerBusiness.DeletaBanner(idBanner); idBanner = 0; Alert("É obrigatório selecionar a imagem!"); } if (idBanner != 0) { Alert("Banner incluido com sucesso!"); CarregaGridView(); } else { Alert("Ocorreu um erro ao incluir o Banner!"); } CarregaGridView(); }
public bool Delete(BannerEntity entity) { try { _bannerRepository.Delete(entity); return(true); } catch (Exception e) { _log.Error(e, "数据库操作出错"); return(false); } }
public BannerEntity Update(BannerEntity entity) { try { _bannerRepository.Update(entity); return(entity); } catch (Exception e) { _log.Error(e, "数据库操作出错"); return(null); } }
public bool Delete(int Id) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { BannerEntity _BannerEntity = new BannerEntity(Id); if (adapter.FetchEntity(_BannerEntity)) { adapter.DeleteEntity(_BannerEntity); toReturn = true; } } return toReturn; }
private tbBanner CastBanner(BannerEntity banner) { tbBanner tb = new tbBanner(); tb.Ativo = banner.Ativo; tb.dataAte = banner.dataAte; tb.dataDe = banner.dataDe; tb.estado = banner.estado; tb.idCliente = banner.idCliente; tb.idTipoBanner = banner.idTipoBanner; tb.responsavelUltimaAlteracao = banner.responsavelUltimaAlteracao; tb.DataUltimaAlteracao = banner.DataUltimaAlteracao; return(tb); }
public async Task <IActionResult> Create([Bind("Id,EntityId")] BannerEntity bannerEntity) { if (ModelState.IsValid) { if (bannerEntity.EntityId != default && !_context.EntitiesBase.Any(x => x.Id == bannerEntity.EntityId)) { ModelState.AddModelError("", "Id связанного объекта не существует"); return(View()); } _context.Add(bannerEntity); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Edit), new { id = bannerEntity.Id })); } return(View(bannerEntity)); }
public void FindByIdBannerTest() { BannerEntity banner10 = new BannerEntity(EBannerType.TOP, "Banner 6", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner10.SetSubtitle("Banner 6"); banner10.SetDescription("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetUrlNavigate("/"); banner10.SetHeigth(1600); banner10.SetHeigth(599); _bannerRepo.Add(banner10); BannerEntity banner = _bannerRepo.Query(a => a.Id == 2).FirstOrDefault(); Assert.IsNotNull(banner); }
//public List<BannerEntity> GetBannerList() //{ // List<BannerEntity> Banner = new List<BannerEntity>(); // Banner.Add(new BannerEntity() { BannerId = 1, BannerName = "MAKE A DIFFERENCE THANK" ,StatusId = 1,StatusName ="Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 2, BannerName = "Annodata Rewards", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 3, BannerName = "arkle finance", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 4, BannerName = "Asset Advantage", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 5, BannerName = "blizzardrewards", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 6, BannerName = "BTLB Rewards", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 7, BannerName = "clearwinnersclub", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 8, BannerName = "Cordoba Slider", StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 9, BannerName = "CVD Rewards" ,StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 10, BannerName = "D and D Leasing Rewards",StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 11, BannerName = "Default Banner" ,StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 12, BannerName = "Econocom Rewards" ,StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 13, BannerName = "fr.pbmakeadifferencethankyou",StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 14, BannerName = "GO SKIPPY" ,StatusId = 1, StatusName = "Enabled" }); // Banner.Add(new BannerEntity() { BannerId = 15, BannerName = "Grenke Rewards" ,StatusId = 1, StatusName = "Enabled" }); // return Banner; //} public BannerEntity GetBannerById(int bannerId) { BannerEntity bannerEntity = new BannerEntity(); List <BannerEntity> bannerDetail = new List <BannerEntity>(); try { var paramBannerId = new SqlParameter { ParameterName = "bannerId", DbType = DbType.Int32, Value = bannerId }; bannerEntity = BannerEntityGenericRepository.ExecuteSQL <BannerEntity>("GetBannerById", paramBannerId).ToList <BannerEntity>().FirstOrDefault(); return(bannerEntity); } catch (Exception e) { throw; } }
public ActionResult GetPageListJson(Pagination pagination, string keyword) { var watch = CommonHelper.TimerStart(); BannerEntity para = new BannerEntity(); if (keyword != "") { para.Name = keyword; } var pageList = BannerBLL.Instance.GetPageList(para, ref pagination); var JsonData = new { rows = pageList, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
public ActionResult SaveForm(string keyValue, BannerEntity entity) { try { if (keyValue == "") { //新增 entity.BannerId = Util.Util.NewUpperGuid(); BannerBLL.Instance.Add(entity); } else { entity.BannerId = keyValue; BannerBLL.Instance.Update(entity); } return(Success("操作成功。")); } catch (Exception ex) { return(Error("操作失败。")); } }
public virtual ActionResult Remove(string[] id) { var result = new Dictionary <string, object>(); var rev = false; if (id != null) { var infos = new List <BannerEntity>(); foreach (var i in id) { var info = new BannerEntity { Id = i.Convert <long>(), SaveType = SaveType.Remove }; infos.Add(info); } rev = this.SaveEntities(infos); } result.Add("Status", rev); return(this.Jsonp(result)); }
/// <summary> /// 创建实体 /// </summary> /// <param name="saveType"></param> /// <returns></returns> public virtual BannerEntity CreateEntity(SaveType saveType) { var entity = new BannerEntity { Url = string.IsNullOrWhiteSpace(Url) ? "" : Url, IsShow = IsShow.HasValue? IsShow.Value:true, Sequence = Sequence == null ? 1 : Sequence.Value, FileName = string.IsNullOrWhiteSpace(FileName) ? "" : FileName, SaveType = saveType }; if (!string.IsNullOrEmpty(FileName)) { entity.FileByte = Ioc.Resolve <IFileApplicationService>().Grab(FileName.Substring(FileName.IndexOf("/Files"))); entity.FileName = string.Format("Files/Images/SiteBanner/copy{0}", Path.GetExtension(FileName)); } if (saveType == SaveType.Modify) { entity.Id = Id.Convert <long>(); if (!string.IsNullOrEmpty(Url)) { entity.SetProperty(it => it.Url); } if (IsShow != null) { entity.SetProperty(it => it.IsShow); } if (FileName != null) { entity.SetProperty(it => it.FileName); } if (Sequence != null) { entity.SetProperty(it => it.Sequence); } } return(entity); }
public int InsereBanner(BannerEntity banner) { int idBanner = 0; try { using (var context = new CirculoNegocioEntities()) { tbBanner tb = CastBanner(banner); context.tbBanners.AddObject(tb); context.SaveChanges(); idBanner = tb.id; } return(idBanner); } catch (Exception) { return(0); } }
public BannerEntity SelectOne(int Id) { BannerEntity toReturn = null; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { BannerEntity _BannerEntity = new BannerEntity(Id); if (adapter.FetchEntity(_BannerEntity)) { toReturn = _BannerEntity; } } return toReturn; }
public bool Update(BannerEntity _BannerEntity) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { RelationPredicateBucket filter = new RelationPredicateBucket(); IPredicateExpression _PredicateExpression = new PredicateExpression(); _PredicateExpression.Add(BannerFields.Id == _BannerEntity.Id); filter.PredicateExpression.Add(_PredicateExpression); adapter.UpdateEntitiesDirectly(_BannerEntity, filter); toReturn = true; } return toReturn; }
public BannerEntity SaveFrom(BannerEntity saveModel) { return(Save(saveModel, "banner_")); }
public void AddBannerTest() { BannerEntity banner = new BannerEntity(EBannerType.DEPARTAMENT, "Açougue", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner.SetSubtitle("Carnes fresquinhas"); banner.SetDescription("Carnes fresquinhas"); banner.SetTipText("Açougue"); banner.SetUrlNavigate("/"); _bannerRepo.Add(banner); BannerEntity banner2 = new BannerEntity(EBannerType.DEPARTAMENT, "Padaria", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner2.SetSubtitle("Pães fresquinhos"); banner2.SetDescription("Carnes fresquinhas"); banner2.SetTipText("Açougue"); banner2.SetUrlNavigate("/"); _bannerRepo.Add(banner2); BannerEntity banner3 = new BannerEntity(EBannerType.DEPARTAMENT, "Hortifruti", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner3.SetSubtitle("Frutas fresquinhas"); banner3.SetDescription("Carnes fresquinhas"); banner3.SetTipText("Frutas fresquinhas"); banner3.SetTipText("Açougue"); banner3.SetUrlNavigate("/"); _bannerRepo.Add(banner3); BannerEntity banner4 = new BannerEntity(EBannerType.DEPARTAMENT, "Congelados", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner4.SetSubtitle("Melhores marcas"); banner4.SetDescription("Melhores marcas"); banner4.SetTipText("Açougue"); banner4.SetTipText("Açougue"); banner4.SetUrlNavigate("/"); _bannerRepo.Add(banner4); BannerEntity banner5 = new BannerEntity(EBannerType.TOP, "Banner 1", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner5.SetSubtitle("Banner 1"); banner5.SetDescription("Banner 1"); banner5.SetTipText("Banner 1"); banner5.SetTipText("Banner 1"); banner5.SetUrlNavigate("/"); banner5.SetHeigth(1600); banner5.SetHeigth(599); _bannerRepo.Add(banner5); BannerEntity banner6 = new BannerEntity(EBannerType.TOP, "Banner 2", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner6.SetSubtitle("Banner 2"); banner6.SetDescription("Banner 2"); banner6.SetTipText("Banner 2"); banner6.SetTipText("Banner 2"); banner6.SetUrlNavigate("/"); banner6.SetHeigth(1600); banner6.SetHeigth(599); _bannerRepo.Add(banner6); BannerEntity banner7 = new BannerEntity(EBannerType.TOP, "Banner 3",DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner7.SetSubtitle("Banner 3"); banner7.SetDescription("Banner 3"); banner7.SetTipText("Banner 3"); banner7.SetTipText("Banner 3"); banner7.SetUrlNavigate("/"); banner7.SetHeigth(1600); banner7.SetHeigth(599); _bannerRepo.Add(banner7); BannerEntity banner8 = new BannerEntity(EBannerType.TOP, "Banner 4", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner8.SetSubtitle("Banner 4"); banner8.SetDescription("Banner 4"); banner8.SetTipText("Banner 4"); banner8.SetTipText("Banner 4"); banner8.SetUrlNavigate("/"); _bannerRepo.Add(banner8); BannerEntity banner9 = new BannerEntity(EBannerType.TOP, "Banner 5", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner9.SetSubtitle("Banner 5"); banner9.SetDescription("Banner 5"); banner9.SetTipText("Banner 5"); banner9.SetTipText("Banner 5"); banner9.SetUrlNavigate("/"); banner9.SetHeigth(1600); banner9.SetHeigth(599); _bannerRepo.Add(banner9); BannerEntity banner10 = new BannerEntity(EBannerType.TOP, "Banner 6", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner10.SetSubtitle("Banner 6"); banner10.SetDescription("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetUrlNavigate("/"); banner10.SetHeigth(1600); banner10.SetHeigth(599); _bannerRepo.Add(banner10); this._uow.SaveChanges(); Assert.IsTrue(banner.Id > 0); }
public void Add(BannerEntity entity) { _context.Entry(entity).State = EntityState.Added; }
public void FindByIdBannerTest() { BannerEntity banner10 = new BannerEntity(EBannerType.TOP, "Banner 6",DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner10.SetSubtitle("Banner 6"); banner10.SetDescription("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetUrlNavigate("/"); banner10.SetHeigth(1600); banner10.SetHeigth(599); _bannerRepo.Add(banner10); BannerEntity banner = _bannerRepo.Query(a => a.Id == 2).FirstOrDefault(); Assert.IsNotNull(banner); }
public bool Update(BannerEntity _BannerEntity, RelationPredicateBucket filter) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { adapter.UpdateEntitiesDirectly(_BannerEntity, filter); toReturn = true; } return toReturn; }
public void Update(BannerEntity entity) { var item = _context.Set <BannerEntity>().Find(entity.Id); _context.Entry(item).CurrentValues.SetValues(entity); }
public bool Update(int Id, string BannerUrl, string LogoUrl) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { BannerEntity _BannerEntity = new BannerEntity(Id); if (adapter.FetchEntity(_BannerEntity)) { _BannerEntity.BannerUrl = BannerUrl; _BannerEntity.LogoUrl = LogoUrl; adapter.SaveEntity(_BannerEntity, true); toReturn = true; } } return toReturn; }
public BannerEntity Insert(string BannerUrl, string LogoUrl) { BannerEntity _BannerEntity = new BannerEntity(); using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { _BannerEntity.BannerUrl = BannerUrl; _BannerEntity.LogoUrl = LogoUrl; adapter.SaveEntity(_BannerEntity, true); } return _BannerEntity; }
public BannerEntity Insert(BannerEntity _BannerEntity) { using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { adapter.SaveEntity(_BannerEntity, true); } return _BannerEntity; }
public void AddBannerTest() { BannerEntity banner = new BannerEntity(EBannerType.DEPARTAMENT, "Açougue", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner.SetSubtitle("Carnes fresquinhas"); banner.SetDescription("Carnes fresquinhas"); banner.SetTipText("Açougue"); banner.SetUrlNavigate("/"); _bannerRepo.Add(banner); BannerEntity banner2 = new BannerEntity(EBannerType.DEPARTAMENT, "Padaria", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner2.SetSubtitle("Pães fresquinhos"); banner2.SetDescription("Carnes fresquinhas"); banner2.SetTipText("Açougue"); banner2.SetUrlNavigate("/"); _bannerRepo.Add(banner2); BannerEntity banner3 = new BannerEntity(EBannerType.DEPARTAMENT, "Hortifruti", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner3.SetSubtitle("Frutas fresquinhas"); banner3.SetDescription("Carnes fresquinhas"); banner3.SetTipText("Frutas fresquinhas"); banner3.SetTipText("Açougue"); banner3.SetUrlNavigate("/"); _bannerRepo.Add(banner3); BannerEntity banner4 = new BannerEntity(EBannerType.DEPARTAMENT, "Congelados", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner4.SetSubtitle("Melhores marcas"); banner4.SetDescription("Melhores marcas"); banner4.SetTipText("Açougue"); banner4.SetTipText("Açougue"); banner4.SetUrlNavigate("/"); _bannerRepo.Add(banner4); BannerEntity banner5 = new BannerEntity(EBannerType.TOP, "Banner 1", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner5.SetSubtitle("Banner 1"); banner5.SetDescription("Banner 1"); banner5.SetTipText("Banner 1"); banner5.SetTipText("Banner 1"); banner5.SetUrlNavigate("/"); banner5.SetHeigth(1600); banner5.SetHeigth(599); _bannerRepo.Add(banner5); BannerEntity banner6 = new BannerEntity(EBannerType.TOP, "Banner 2", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner6.SetSubtitle("Banner 2"); banner6.SetDescription("Banner 2"); banner6.SetTipText("Banner 2"); banner6.SetTipText("Banner 2"); banner6.SetUrlNavigate("/"); banner6.SetHeigth(1600); banner6.SetHeigth(599); _bannerRepo.Add(banner6); BannerEntity banner7 = new BannerEntity(EBannerType.TOP, "Banner 3", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner7.SetSubtitle("Banner 3"); banner7.SetDescription("Banner 3"); banner7.SetTipText("Banner 3"); banner7.SetTipText("Banner 3"); banner7.SetUrlNavigate("/"); banner7.SetHeigth(1600); banner7.SetHeigth(599); _bannerRepo.Add(banner7); BannerEntity banner8 = new BannerEntity(EBannerType.TOP, "Banner 4", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner8.SetSubtitle("Banner 4"); banner8.SetDescription("Banner 4"); banner8.SetTipText("Banner 4"); banner8.SetTipText("Banner 4"); banner8.SetUrlNavigate("/"); _bannerRepo.Add(banner8); BannerEntity banner9 = new BannerEntity(EBannerType.TOP, "Banner 5", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner9.SetSubtitle("Banner 5"); banner9.SetDescription("Banner 5"); banner9.SetTipText("Banner 5"); banner9.SetTipText("Banner 5"); banner9.SetUrlNavigate("/"); banner9.SetHeigth(1600); banner9.SetHeigth(599); _bannerRepo.Add(banner9); BannerEntity banner10 = new BannerEntity(EBannerType.TOP, "Banner 6", DateTime.Now.AddDays(-1), DateTime.Now.AddDays(+30)); banner10.SetSubtitle("Banner 6"); banner10.SetDescription("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetTipText("Banner 6"); banner10.SetUrlNavigate("/"); banner10.SetHeigth(1600); banner10.SetHeigth(599); _bannerRepo.Add(banner10); this._uow.SaveChanges(); Assert.IsTrue(banner.Id > 0); }
public void Update(BannerEntity entity) { var item = _context.Set<BannerEntity>().Find(entity.Id); _context.Entry(item).CurrentValues.SetValues(entity); }
public int InsereBanner(BannerEntity banner) { return(lObjBannerDAL.InsereBanner(banner)); }
public ActionResult GetFormJson(string keyValue) { BannerEntity bannerEntity = bannerApp.GetEntityBySid(keyValue); return(Content(ApiHelper.JsonSerial(bannerEntity))); }