public IActionResult VideoRelationship_Partial(int?page, int id)
 {
     if (page == null)
     {
         page = 1;
     }
     if (id != 0 && id > 0)
     {
         var video   = _videoService.FinVideoAsync(id).Result;
         var lVideo  = _videoService.GetAll().Where(x => x.CategorysId == video.CategorysId && x.Id != video.Id).ToList();
         var lUser   = _userService.GetAll();
         var list_vm = _videoService.GetVideo_Vm(lVideo, lUser).OrderByDescending(x => x.Id).ToPagedList((int)page, 8);
         foreach (var item in list_vm)
         {
             item.CreateDate = CaculatorHours.Caculator(item.CreateDate);
         }
         return(View(list_vm));
     }
     return(View(null));
 }
        public IActionResult SubscriptionChannel(int?page, bool flag = false)
        {
            ViewBag.ForCus = 2;
            GetNotificationHome();
            if (page == null)
            {
                page = 1;
            }
            var pageNumber = page ?? 1;
            var pageSize   = 12;
            IPagedList <Video_vm> listVideo_Vm;

            if (User.Identity.IsAuthenticated)
            {
                var userLogin = UserAuthenticated.GetUser(User.Identity.Name);
                ViewBag.UserFollow = _userService.GetUserFollow(userLogin.UserName);
                ViewBag.IdUser     = userLogin.Id;
                ViewBag.PlayList   = _playListService.GetAll().Where(x => x.UserId == ViewBag.IdUser).ToList();
                var listFollow = _channelService.GetAll().Where(x => x.FromUserId == userLogin.Id).ToList();
                var listVideo  = (from video in _videoService.GetAll()
                                  join follow in listFollow on video.AppUserId equals follow.ToUserId
                                  select video).ToList();
                var listUser = _userService.GetAll();
                listVideo_Vm = _videoService.GetVideo_Vm(listVideo, listUser).
                               OrderByDescending(x => x.Id).ToPagedList(pageNumber, pageSize);
                if (flag)
                {
                    foreach (var item in listVideo_Vm)
                    {
                        item.CreateDate = CaculatorHours.Caculator(item.CreateDate);
                    }
                    return(Content(JsonConvert.SerializeObject(listVideo_Vm)));
                }
                return(View(listVideo_Vm));
            }
            listVideo_Vm = null;
            return(View(listVideo_Vm));
        }
Exemplo n.º 3
0
        public string Getdate()
        {
            var date = CaculatorHours.Caculator(new GetDateNow().DateNow);

            return(date);
        }