public void PushToSubscribers(NewsDetailsModel data, string topicName) { if (data == null || string.IsNullOrWhiteSpace(topicName)) { return; } List <ISubscriber> subscribers = GetSubscribers(topicName); if (subscribers == null) { return; } foreach (var subscriber in subscribers) { try { subscriber.DisplayData(data); } catch { Console.WriteLine("Error in subscriber"); } } }
public async Task <IActionResult> Get(string id) { return(await this.Execute(false, true, async() => { NewsDetailsModel news = await this.news.Get(id); return this.Ok(new { news = news }); })); }
public NewsDetailsViewModel(News news) { this.news = news; Title = "新闻"; NewsDetails = new NewsDetailsModel() { CommentDisplay = news.CommentCount > 0 ? news.CommentCount.ToString() : "评论" }; IsBusy = true; }
public NewsDetailsViewModel(News news) { this.news = news; Title = news.Title; NewsDetails = new NewsDetailsModel() { DiggDisplay = news.DiggCount > 0 ? news.DiggCount.ToString() : "推荐", CommentDisplay = news.CommentCount > 0 ? news.CommentCount.ToString() : "评论", ViewDisplay = news.ViewCount > 0 ? news.ViewCount.ToString() : "阅读" }; }
public NewsDetailsViewModel(News news) { this.news = news; Title = news.Title; NewsDetails = new NewsDetailsModel() { HasContent = false, DiggDisplay = news.DiggCount > 0 ? news.DiggCount.ToString() : "推荐", CommentDisplay = news.CommentCount > 0 ? news.CommentCount.ToString() : "评论", ViewDisplay = news.ViewCount > 0 ? news.ViewCount.ToString() : "阅读", DateDisplay = "发布于 " + news.DateDisplay }; }
// GET: News/Details/5 public ActionResult Details(int id) { var e = _manager.GetNews(id); var model = new NewsDetailsModel { CreationDate = e.CreationDate, LastUpdateDate = e.LastUpdateDate, Author = e.Author, Title = e.Title, ShortDescription = e.ShortDescription, Description = e.Description }; return PartialView("_Details", model); }
/// <summary> /// The detail page. /// </summary> /// <param name="id">the news id.</param> /// <returns></returns> public async Task <ActionResult> Details(int id = 0) { if (id == 0) { return(RedirectToAction("Index")); } NewsDetailsModel detail = new NewsDetailsModel { SubscriberFormData = new SubscriberFormData(), OccurrencesViewData = await GetOccurrences(), PartnersViewData = await GetPartners(), NewsViewData = await FindNews(id), NewsViewDatas = await GetNews() }; return(View(detail)); }
public void DisplayData(NewsDetailsModel news) { Console.WriteLine($"In subscriber {Topic}."); Console.WriteLine($"{news.Title} on {news.PublishDate.ToShortDateString()}"); Console.WriteLine(news.Description); }
public void Publish(NewsDetailsModel data, string topicName) { Filter.FilterInstance.PushToSubscribers(data, topicName); }
public void DisplayData(NewsDetailsModel news) { Console.WriteLine($"In subscriber {Topic}."); Console.WriteLine($"News for {news.Category}: {news.Title} by {news.Author}"); Console.WriteLine(news.Description); }