public async Task EntryDetail(BlogForDetailsDto blogForDetailsDto) { blogForDetailsDto.selectedEntry = await _context.TEntry.FirstOrDefaultAsync(m => m.Id == blogForDetailsDto.id); blogForDetailsDto.selectedEntryComments = await _context.TComment.Where(c => c.EntryId == blogForDetailsDto.selectedEntry.Id).ToListAsync(); foreach (var comment in blogForDetailsDto.selectedEntryComments) { comment.TReply = await _context.TReply.Where(r => r.CommentId == comment.Id).ToListAsync(); } }
// GET: Blog/Details/5 public async Task <IActionResult> Details(BlogForDetailsDto blogForDetailsDto) { if (blogForDetailsDto.id == null) { return(NotFound()); } await _entryRepo.EntryDetail(blogForDetailsDto); await InitializeModel(); model.Location = "YAZILARIMIZ"; ViewBag.Blog = "class = active"; model.Entry = blogForDetailsDto.selectedEntry; model.Comments = blogForDetailsDto.selectedEntryComments; model.RandomEntry = await _entryRepo.RandomEntry(); while (model.RandomEntry.Id == model.Entry.Id) { model.RandomEntry = await _entryRepo.RandomEntry(); } if (!String.IsNullOrEmpty(blogForDetailsDto.searchString)) { return(RedirectToAction("BlogList", "Blog", new { blogForDetailsDto.searchString })); } if (model == null) { return(NotFound()); } var location = new Uri($"{Request.Scheme}://{Request.Host}{Request.Path}{Request.QueryString}"); var url = location.AbsoluteUri; ViewBag.MetaTags = _metaTagService.CreateMetas($"{model.Entry.Header} | Mizgin Doğan Hukuk", model.Entry.EntrySummary , string.Join(",", model.Entry.Tags), model.Entry.PostedBy, owner, 2019, model.Entry.ImageUrlMed, url, model.Entry.ImageUrlLarge, siteName, model.Entry.Header); return(View(model)); }