Esempio n. 1
0
        public EntityDto GetById(int id)
        {
            var Entity    = EntityProvider.GetById(id);
            var EntityDto = mapper.Map <EntityDto>(Entity);

            return(EntityDto);
        }
        public Result Handle(ApproveNewsCommand command)
        {
            //news should be picked from queue
            //approved and removed from the queue
            //db entry for the item
            //pushed to solr
            //send email to the queue
            var news = _provider.GetById(command.NewsId);

            news.Approved = true;
            _provider.Update(news);
            var solrNews = new SolrNewsItem()
            {
                Category  = null,
                Details   = news.Details,
                Id        = news.Id,
                Source    = news.Source.Name,
                Title     = news.Title,
                Thumbnail = news.Images.FirstOrDefault()?.ImagePath
            };

            _solrOperation.AddAsync(solrNews);
            return(Result.Ok());
        }
 public News Handle(GetNewsQuery query)
 {
     //this will get an individual news item
     return(_provider.GetById(query.NewsId));
 }