public IActionResult All() { if (!this.User.IsAuthenticated) { return(this.RedirectToHome()); } var kittens = this._kitten .All() .Select(k => $@"<div class=""col-4""> <img class=""img-thumbnail"" src=""{k.Url}"" /><div> <h5>Name: {k.Name}</h5> <h5>Age: {k.Age}</h5> <h5>Breed: {EnumHelper.ConvertEnum(k.Breed)}</h5> </div> </div>") .ToList(); var kittensResult = new StringBuilder(); kittensResult.Append(@"<div class=""row text-center"">"); for (int i = 0; i < kittens.Count; i++) { kittensResult.Append(kittens[i]); if (i % 3 == 3 - 1) { kittensResult.Append(@"</div><div class=""row text-center"">"); } } kittensResult.Append("</div>"); this.Model.Data["kittens"] = kittensResult.ToString(); return(this.View()); }