public IActionResult Index() { var events = _newsData.GetNewsWithAuthor(); var model = new List <NewsShortViewModel>(); foreach (var e in events) { model.Add(new NewsShortViewModel { Id = e.Id, Author = string.IsNullOrEmpty(e.Author.Name) || string.IsNullOrEmpty(e.Author.Surname) ? e.Author.UserName : $"{e.Author.Name} {e.Author.Surname}", ImageUrl = e.ImageUrl, ReleaseTime = e.ReleaseTime, TextPreview = StringFormatter.FormatForPreview(e.Text), Title = e.Name, }); } return(View(model)); }