Beispiel #1
0
 public static UpdatesComponentViewModel Initialize(this UpdatesComponentViewModel model, List <Update> updates, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
 {
     return(new UpdatesComponentViewModel
     {
         Updates = updates.Select(u => new OneUpdateViewModel().Initialize(u, tagTranslator, timestampFormatter)).ToList()
     });
 }
        public async Task <IViewComponentResult> InvokeAsync(int count = 20)
        {
            var updates = await dbContext.Updates
                          .Include(u => u.Anime)
                          .OrderByDescending(u => u.Timestamp)
                          .Take(count)
                          .ToListAsync();

            var model = new UpdatesComponentViewModel().Initialize(updates, tagTranslator, timestampFormatter);

            return(View(model));
        }