Beispiel #1
0
        public async Task LoadVideo(VideoListDTO video)
        {
            PornRepository PornRep = new PornRepository();

            ShowVideo = true;
            Video     = await PornRep.GetVideoByIdAsync(video.Id, currentCulture);
        }
Beispiel #2
0
        public async Task <VideoDetailDTO> GetVideoByIdAsync(int Id, string culture)
        {
            using (var db = new myDb())
            {
                db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
                Video video = await db.Videos.FindAsync(Id);

                video.Views++;
                await db.SaveChangesAsync();

                VideoDetailDTO vid = new VideoDetailDTO();
                vid.Id  = video.Id;
                vid.Img = video.Img;
                if (culture == "cs-CZ")
                {
                    vid.Title      = video.Title;
                    vid.Categories = video.Categories.Select(x => new CategoryDTO()
                    {
                        Id   = x.Id,
                        Name = x.Name
                    }).ToList();
                }
                else
                {
                    vid.Title      = video.Title_en;
                    vid.Categories = video.Categories.Select(x => new CategoryDTO()
                    {
                        Id   = x.Id,
                        Name = x.Name_en
                    }).ToList();
                }
                vid.Url         = video.Url;
                vid.Views       = video.Views;
                db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
                CookieRepository CookieRep = new CookieRepository();
                CookieRep.UpdateCategoryCookie(vid.Categories);
                CookieRep.UpdateHistoryCookie(video.Id.ToString());
                return(vid);
            }
        }