//[TestMethod] public async Task GetNewsTest() { var news = new NewsBusiness(); var result = await news.GetNews(); result.Should().NotBeEmpty(); }
public async Task AddNews() { var news = new NewsBusiness(); var list = new List <ViewModels.News> { new ViewModels.News { Show = true, Id = Guid.NewGuid(), Approved = true, Description = "Area 51 is working with Church on The Street (COTS). We have committed to assist one Sunday a month and will need 5 volunteers each month.", End = new DateTime(2015, 12, 31), Link = "http://www.signupgenius.com/go/9040b44a5ab23a57-church1?utm_source=Pax&utm_campaign=8c5dc78a00-Newsletter_9_6_2015&utm_medium=email&utm_term=0_e2070eb2f3-8c5dc78a00-53412961", Order = 1, Start = new DateTime(2015, 9, 6), Title = "Church on the Street" }, new ViewModels.News { Show = true, Id = Guid.NewGuid(), Approved = true, Description = "Area 51 is working with Church on The Street (COTS). We have committed to assist one Sunday a month and will need 5 volunteers each month.", End = new DateTime(2015, 12, 31), Link = "http://www.signupgenius.com/go/9040b44a5ab23a57-church1?utm_source=Pax&utm_campaign=8c5dc78a00-Newsletter_9_6_2015&utm_medium=email&utm_term=0_e2070eb2f3-8c5dc78a00-53412961", Order = 1, Start = new DateTime(2015, 9, 6), Title = "Church on the Street" } }; await news.AddNews(list); }
public ActionResult RssFeed(long id) { NewsBusiness newsBusiness = new NewsBusiness(); List <Common.SearchNewByGroupID_Result> model = new List <Common.SearchNewByGroupID_Result>(); int totalRecord = 0; model = _newsBusiness.ListByNewsIdNewsGroup(id, ref totalRecord, 1, 10000); var items = new List <SyndicationItem>(); foreach (SearchNewByGroupID_Result re in model) { var item = new SyndicationItem() { Id = re.Id.ToString(), Title = SyndicationContent.CreatePlaintextContent(re.Title), Content = SyndicationContent.CreateHtmlContent(re.Descriptions), PublishDate = re.CreateDate }; string url = Util.ReturnLinkFull(re.FriendlyUrl); item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(url)));//Nothing alternate about it. It is the MAIN link for the item. items.Add(item); } return(new RssFeed(title: "Greatness", items: items, contentType: "application/rss+xml", description: String.Format("Sooper Dooper {0}", Guid.NewGuid()))); }
protected virtual IActionResult UpdateLastNews() { RunAsync(() => { var news = NewsBusiness.UpdateLastNews(); HubContext.Clients.All.SendAsync("addLastNews", news).Wait(); }); return(Ok()); }
public BaseController() : base() { loginBusiness = new LoginBusiness(this.GetContext()); userBusiness = new UserBusiness(this.GetContext()); categoryBusiness = new CategoryBusiness(this.GetContext()); servicePlanBusiness = new ServicePlanBusiness(this.GetContext()); newsBusiness = new NewsBusiness(this.GetContext()); customerBusiness = new CustomerBusiness(this.GetContext()); orderBusiness = new OrderBusiness(this.GetContext()); customerServicePlan = new CustomerServicePlanBusiness(this.GetContext()); }
public JsonResult GetNewsname(string term) { NewsBusiness _newsBusiness1 = new NewsBusiness(); try { List <Common.SearchNewByName_Result> data = _newsBusiness1.SearchListNewByName(term); return(Json(data, JsonRequestBehavior.AllowGet)); } catch (Exception) { //Write log throw; } }
public BaseAPIController() : base() { lgBus = new LoginBusiness(this.GetContext()); newsBus = new NewsBusiness(this.GetContext()); notiBus = new NotifyBusiness(this.GetContext()); giftBus = new GiftBusiness(this.GetContext()); rqBus = new RequestBusiness(this.GetContext()); cusBus = new CustomerBusiness(this.GetContext()); mBus = new MessageBusiness(this.GetContext()); apiBus = new RequestAPIBusiness(this.GetContext()); pBus = new PointBusiness(this.GetContext()); statisticBus = new StatisticBusiness(this.GetContext()); shopBus = new ShopBusiness(this.GetContext()); itemBus = new ItemBusiness(this.GetContext()); orderBus = new OrderBusiness(this.GetContext()); packBus = new PackageBusiness(this.GetContext()); vnPay = new VNPay(this.GetContext()); }
public BaseController() : base() { loginBusiness = new LoginBusiness(this.GetContext()); batchBusiness = new BatchBusiness(this.GetContext()); cardBusiness = new CardBusiness(this.GetContext()); requestBusiness = new RequestBusiness(this.GetContext()); newsBusiness = new NewsBusiness(this.GetContext()); cusBusiness = new CustomerBusiness(this.GetContext()); rankBusiness = new RankBusiness(this.GetContext()); configBusiness = new ConfigBusiness(this.GetContext()); pointBusiness = new PointBusiness(this.GetContext()); warrantyBusiness = new WarrantyBusiness(this.GetContext()); statisticBus = new StatisticBusiness(this.GetContext()); orderBus = new OrderBusiness(this.GetContext()); userBusiness = new UserBusiness(this.GetContext()); itemBusiness = new ItemBusiness(this.GetContext()); productsBusiness = new ItemBusiness(this.GetContext()); notifyBusiness = new NotifyBusiness(this.GetContext()); shopBusiness = new ShopBusiness(this.GetContext()); agentBusiness = new AgentBusiness(this.GetContext()); vnpay = new VNPay(this.GetContext()); }
public JsonResult UpdateNews(Common.News viewNews) { try { NewsBusiness newsBusiness = new NewsBusiness(); var dbNews = newsBusiness.GetById(viewNews.Id); dbNews.NewsGroupId = viewNews.NewsGroupId; dbNews.Title = viewNews.Title; dbNews.ImageSource = viewNews.ImageSource; dbNews.Summary = viewNews.Summary; dbNews.Descriptions = viewNews.Descriptions; dbNews.Status = viewNews.Status; dbNews.isPublic = viewNews.isPublic; dbNews.ModifyDate = DateTime.Now; dbNews.AdminIDApproval = viewNews.AdminIDApproval; newsBusiness.Edit(dbNews); return(Json(1));//Cập nhật thành công } catch (Exception) { throw; } }
protected IActionResult ListNews(int?top, int?lastNewsId) { return(Ok(NewsBusiness.ListNews(top, lastNewsId))); }
public void DeleteNews(int code, string username, string password) { IManager<News> business = new NewsBusiness(); business.Delete(code, username, password); }
public int AddNews(News element, string username, string password) { IManager<News> business = new NewsBusiness(); return business.Add(element, username, password); }
public int GetNewsLastInsertedId() { IReaderLimit<News> business = new NewsBusiness(); return business.GetLastInsertedId(); }
public IEnumerable<News> SearchNews(string keywords) { ISearchable<News> business = new NewsBusiness(); return business.Search(keywords); }
public IEnumerable<News> GetListNewsLimited(int indexFirstElement, int numberOfResults) { IReader2Filters<News, Member, bool?> business = new NewsBusiness(); return business.Get(true, indexFirstElement, numberOfResults); }
public News GetNews(int code) { IReader<News> business = new NewsBusiness(); return business.Get(code); }
public IEnumerable<News> GetListNews() { IReader2Filters<News, Member, bool?> business = new NewsBusiness(); return business.Get(true); }
public ActionResult Khuyenmai(long id = 0, int page = 1, int pageSize = 10) { try { NewsBusiness newsBusiness = new NewsBusiness(); int totalRecord = 0; int totalPage = 0; List <Common.SearchNewByGroupID_Result> model = new List <Common.SearchNewByGroupID_Result>(); ViewBag.GroupID = id; model = _newsBusiness.ListByNewsIdNewsGroup(id, ref totalRecord, page, pageSize); ViewBag.NewsGroup = _newsGroupBusiness.GetById(id); ViewBag.Total = totalRecord; ViewBag.Page = page; int maxPage = 1; totalPage = (int)Math.Ceiling((double)(totalRecord / pageSize)); ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Last = totalPage; ViewBag.Next = page + 1; ViewBag.Prev = page - 1; NewsGroupBusiness newsGroupBusiness = new Business.ClassBusiness.NewsGroupBusiness(); Common.NewsGroups newsGroup = newsGroupBusiness.GetById(id); if (string.IsNullOrEmpty(newsGroup.SeoTitle)) { ViewBag.Title = newsGroup.NewsGroupName; } else { ViewBag.Title = newsGroup.SeoTitle; } ViewBag.Title = newsGroup.SeoTitle; ViewBag.Description = newsGroup.SeoDescription; ViewBag.Keywords = newsGroup.SeoKeyword; ViewBag.ShareTitle = newsGroup.ShareTitle; ViewBag.ShareKeyword = newsGroup.ShareKeyword; ViewBag.ShareDescription = newsGroup.ShareDescription; ViewBag.published_time = newsGroup.CreateDate; ViewBag.updated_time = newsGroup.ModifyDate; ViewBag.image = newsGroup.ImageSource; ViewBag.TotalVote = newsGroup.TotalVote; ViewBag.VoteScore = newsGroup.VoteScore; ViewBag.CatalogUrl = Function.ConvertFileName(newsGroup.NewsGroupName); return(View(model)); } catch (FaultException ex) { var exep = Function.GetExeption(ex); var codeExp = exep[1]; string url = "Error/ErrorFunction/" + codeExp; return(RedirectToActionPermanent(url)); } return(View()); }
public void EditNews(News element, string username, string password) { IManager<News> business = new NewsBusiness(); business.Edit(element, username, password); }
public IEnumerable<News> GetListNewsLimited(int indexFirstElement, int numberOfResults) { IReaderLimit<News> business = new NewsBusiness(); return business.Get(indexFirstElement, numberOfResults); }
public IEnumerable<News> GetListNews() { IReader<News> business = new NewsBusiness(); return business.Get(); }