コード例 #1
0
        public async Task <IActionResult> VideoDetail(int id, string title = null)
        {
            try
            {
                var existsVideo = await _videorepo.GetById(id);

                if (existsVideo == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                ViewBag.PageSeo      = existsVideo.VG_Seo;
                existsVideo.Comments = await _commentRepository.AcceptedComments(existsVideo.VG_Id, 4);

                existsVideo.Rate = (int)await _rateRepository.CalulateRate(existsVideo.VG_Id, 4);

                return(View(existsVideo));
            }
            catch (Exception ex)
            {
                _logger.LogError("ErrorGalleryController", ex);
                return(View(new List <VideoGalleryModel>()));
            }
        }