예제 #1
0
        public static ReccomendationBlockViewComponent ToViewModel(BasicArticle model)
        {
            var component = new ReccomendationBlockViewComponent();

            component.Slug     = model.Slug;
            component.HeadLine = model.HeadLine;
            component.Img      = model.Img;

            return(component);
        }
        //public string Topic { get; set; }

        public static ReccomendationBlockViewComponent ToViewModel(Entry model)
        {
            var component = new ReccomendationBlockViewComponent();

            component.Slug     = model.Slug;
            component.Url      = model.Url;
            component.HeadLine = model.HeadLine;
            component.Img      = model.Img;
            //component.Topic = model.EntryToTopics.Any() ? model.EntryToTopics.First().Topic.Name : null;

            return(component);
            //return new ReccomendationBlockViewComponent()
            //{
            //    Slug = model.Slug,
            //    Url = model.Url,
            //    HeadLine = model.HeadLine,
            //    Img = model.Img,
            //    Topic = model.EntryToTopics.Any() ? model.EntryToTopics.First().Topic.Name : null
            //};
        }
 public async Task <IViewComponentResult> InvokeAsync(ReccomendationBlockViewComponent component)
 {
     return(View(component));
 }