public static int VideoInfo_DeleteById(int Id) { IVideosService channel = Entity.CreateChannel <IVideosService>(SiteEnum.SiteService.VideoService); var result = channel.VideoInfo_DeleteById(Id); (channel as IDisposable).Dispose(); return(result); }
public static int SendMailLog_UpdateById(SendMailLog obj) { IVideosService channel = Entity.CreateChannel <IVideosService>(SiteEnum.SiteService.VideoService); var result = channel.SendMailLog_UpdateById(obj); (channel as IDisposable).Dispose(); return(result); }
public static VideoCate VideoCate_SelectByc_id(int Id) { IVideosService channel = Entity.CreateChannel <IVideosService>(SiteEnum.SiteService.VideoService); var result = channel.VideoCate_SelectByc_id(Id); (channel as IDisposable).Dispose(); return(result); }
public async Task GetLatestThreeVideosAsync_WithDeletedVideos_ShouldReturnCorrectCount() { //Arrange var expectedResult = 3; var moqPictureService = new Mock <IPicturesService>(); var moqUsersService = new Mock <IUsersService>(); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); var testingVideos = new List <Video> { new Video { Id = 1, Title = "Video1", IsDeleted = true, Link = "link1", CreatedOn = DateTime.UtcNow.AddDays(-25), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 2, Title = "Video2", IsDeleted = false, Link = "link2", CreatedOn = DateTime.UtcNow.AddDays(-25), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 3, Title = "Video3", IsDeleted = true, Link = "link3", CreatedOn = DateTime.UtcNow.AddDays(-25), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 4, Title = "Video4", IsDeleted = false, Link = "link4", CreatedOn = DateTime.UtcNow.AddDays(-20), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 5, Title = "Video5", IsDeleted = false, Link = "link5", CreatedOn = DateTime.UtcNow.AddDays(-5), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 6, Title = "Video6", IsDeleted = false, Link = "link6", CreatedOn = DateTime.UtcNow.AddDays(-2), Picture = new Picture { Link = "PictureLink" } }, }; await db.Videos.AddRangeAsync(testingVideos); await db.SaveChangesAsync(); //Act var actual = await this.videosService.GetLatestThreeVideosAsync(); //Assert Assert.Equal(expectedResult, actual.Videos.Count); }
public HomeController( IForumThreadService threadService, INewsService newsService, IVideosService videoService) { this.threadService = threadService; this.newsService = newsService; this.videoService = videoService; }
public async Task GetAllActiveVideosViewModelsAsync_WithValidData_ShouldReturnCorrectOrder() { //Arrange var expectedResult = new List <int> { 5, 4, 2 };; var moqPictureService = new Mock <IPicturesService>(); var moqUsersService = new Mock <IUsersService>(); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); var testingVideos = new List <Video> { new Video { Id = 1, Title = "Video1", IsDeleted = true, Link = "link1", CreatedOn = DateTime.UtcNow.AddDays(-25), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 2, Title = "Video2", IsDeleted = false, Link = "link2", CreatedOn = DateTime.UtcNow.AddDays(-25), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 3, Title = "Video3", IsDeleted = true, Link = "link3", CreatedOn = DateTime.UtcNow.AddDays(-25), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 4, Title = "Video4", IsDeleted = false, Link = "link4", CreatedOn = DateTime.UtcNow.AddDays(-20), Picture = new Picture { Link = "PictureLink" } }, new Video { Id = 5, Title = "Video5", IsDeleted = false, Link = "link5", CreatedOn = DateTime.UtcNow.AddDays(-5), Picture = new Picture { Link = "PictureLink" } }, }; await db.Videos.AddRangeAsync(testingVideos); await db.SaveChangesAsync(); //Act var actual = this.videosService.GetAllActiveVideosViewModelsAsync(1, 10).GetAwaiter().GetResult().ToList(); //Assert Assert.Equal(expectedResult[0], actual[0].Id); Assert.Equal(expectedResult[1], actual[1].Id); Assert.Equal(expectedResult[2], actual[2].Id); }
public async Task GetFavouriteVideoViewModelsAsync_WithValidData_ShouldReturnCorrectCountOfFavoriteVideos() { //Arrange var expectedResult = 1; var moqPictureService = new Mock <IPicturesService>(); var moqUsersService = new Mock <IUsersService>(); moqUsersService.Setup(x => x.GetCurrentUserAsync()) .ReturnsAsync(new ApplicationUser { Id = "UserId", UserName = "******", }); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); var userFavouriteVideos = new List <UserFavouriteVideo> { new UserFavouriteVideo { Id = 1, VideoId = 2, ApplicationUserId = "UserId" }, }; var testingVideos = new List <Video> { new Video { Id = 1, Title = "Video1", IsDeleted = true, Link = "link1", CreatedOn = DateTime.UtcNow.AddDays(-25) }, new Video { Id = 2, Title = "Video2", IsDeleted = false, Link = "link2", CreatedOn = DateTime.UtcNow.AddDays(-25), UserFavouriteVideos = userFavouriteVideos }, new Video { Id = 3, Title = "Video3", IsDeleted = true, Link = "link3", CreatedOn = DateTime.UtcNow.AddDays(-25) }, new Video { Id = 4, Title = "Video4", IsDeleted = false, Link = "link4", CreatedOn = DateTime.UtcNow.AddDays(-20) }, new Video { Id = 5, Title = "Video5", IsDeleted = false, Link = "link5", CreatedOn = DateTime.UtcNow.AddDays(-5) }, }; await db.Videos.AddRangeAsync(testingVideos); await db.SaveChangesAsync(); //Act var actual = this.videosService.GetFavouriteVideoViewModelsAsync(1, 10).GetAwaiter().GetResult().ToList(); //Assert Assert.Equal(expectedResult, actual.Count); }
public ActionResult Edit(int id) { IVideosService videoSrv = IoC.Resolve <IVideosService>(); IVideoTypeService videoTypeSrv = IoC.Resolve <IVideoTypeService>(); VideoModels model = new VideoModels(); model.Video = videoSrv.Getbykey(id); model.VideoTypes = videoTypeSrv.Query.Where(p => p.Active).OrderBy(p => p.NameVNI).ThenBy(p => p.NameENG).ToList(); return(View(model)); }
public HomeController(IVideosService videosService, IPicturesService picturesService, IPagesService pagesService, IPostsService postsService) { this.videosService = videosService; this.picturesService = picturesService; this.pagesService = pagesService; this.postsService = postsService; }
public AdministrationAreaController(IPagesService pageService, IUsersService usersService, ILogService logsService, IVideosService videosService, IPicturesService picturesService, IPostsService postsService, UserManager <User> userManger) : base(pageService, usersService, logsService, videosService, picturesService, postsService, userManger) { }
public AdminController( INewsService newsService, IForumReplyService replyService, IForumThreadService threadService, IVideosService videosService) { this.newsService = newsService; this.replyService = replyService; this.threadService = threadService; this.videosService = videosService; }
public VideosController( ICategoriesService categoriesService, IVideosService videosService, IHistoriesService historiesService, UserManager <ApplicationUser> userManager) { this.categoriesService = categoriesService; this.videosService = videosService; this.historiesService = historiesService; this.userManager = userManager; }
public HomeController( IArticlesService articlesService, IBooksService booksService, IVideosService videosService, IDownloadMaterialsService downloadsService) { this.articlesService = articlesService; this.booksService = booksService; this.videosService = videosService; this.downloadsService = downloadsService; }
public ClearService( IYoutubeProvider youtubeProvider, ILogger <ClearService> logger, IChannelsService channelsService, IVideosService videosService, IPlaylistsService playlistsService) : base(youtubeProvider, logger) { this.channelsService = channelsService; this.videosService = videosService; this.playlistsService = playlistsService; }
public DailyCheckInitiatedEventHandler(AdminUpdatesWebhook webhook, IAlumniGraduationService alumniGraduationService, IDailyCheckPingService dailyCheckPingService, IDailyCheckSubscriptionPlanCountService dailyCheckSubscriptionPlanCountService, IVideosService videosService, IRepository <DailyCheck> repository) { _webhook = webhook; _alumniGraduationService = alumniGraduationService; _dailyCheckPingService = dailyCheckPingService; _dailyCheckSubscriptionPlanCountService = dailyCheckSubscriptionPlanCountService; _videosService = videosService; _repository = repository; }
public CopyrightService( IYoutubeAuthProvider youtubeAuthProvider, IYoutubeProvider youtubeProvider, ILogger <CopyrightService> logger, string outputFolder, IChannelsService channelsService, IVideosService videosService) : base(youtubeAuthProvider) { this.youtubeProvider = youtubeProvider; this.logger = logger; this.outputFolder = outputFolder; this.channelsService = channelsService; this.videosService = videosService; }
public ActionResult ConfirmUpload(Videos video) { try { IVideosService videoSrv = IoC.Resolve <IVideosService>(); video.LinkType = LinkType.Local; video.CreatedBy = HttpContext.User.Identity.Name; video.VideoPath = "/VideosStore/video/" + video.VideoPath; //Hình ảnh video.URLName = FX.Utils.Common.TextHelper.ToUrlFriendly(video.NameVNI); ConvertVideo conv = new ConvertVideo(video.VideoPath); if (video.VideoPath.IndexOf("mp4") > 0) { Thread thread = new Thread(new ThreadStart(conv.ConvertVideoToWebM)); thread.Start(); } else if (video.VideoPath.IndexOf("webm") > 0) { Thread thread = new Thread(new ThreadStart(conv.ConvertVideoToMp4)); thread.Start(); } string videoFull = video.VideoPath.Split('/')[3]; string videoName = videoFull.Split('.')[0]; string imageName = "/UploadStore/Videos/" + videoName + ".jpg"; video.ImagePath = imageName; videoSrv.CreateNew(video); videoSrv.CommitChanges(); Messages.AddFlashMessage("Thêm mới thành công."); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Video - Create", "Create Video Success", LogType.Success, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); return(new JsonResult() { Data = "Tải Video thành công!" }); } catch (Exception ex) { logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Video - Create", "Create Video Error : " + ex, LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); return(new JsonResult() { Data = "Có lỗi xảy ra vui lòng thực hiện lại." }); } }
public ActionResult Create(Videos video) { try { IVideosService videoSrv = IoC.Resolve <IVideosService>(); video.CreatedBy = HttpContext.User.Identity.Name; video.ImagePath = "/UploadStore/Videos/video.jpg"; video.LinkType = LinkType.Youtube; //Kiểm tra video đường dẫn video chuẩn chưa . if (video.VideoPath.IndexOf("embed") <= 0) { string[] arr = video.VideoPath.Split('='); string yId = arr[1]; if (yId.Length > 0) { string convertToEmbedLink = "https://www.youtube.com/embed/" + yId; video.VideoPath = convertToEmbedLink; //Định dạng chuẩn để xem video = thẻ iframe WebClient cli = new WebClient(); var imgBytes = cli.DownloadData("http://img.youtube.com/vi/" + yId + "/0.jpg"); // System.IO.File.WriteAllBytes(ConfigurationSettings.AppSettings.Get("PhysicalSiteDataDirectory") + @"\_thumbs\Videos\" + yId + ".jpg", imgBytes); video.ImagePath = "/UploadStore/Videos/" + yId + ".jpg"; } } video.URLName = FX.Utils.Common.TextHelper.ToUrlFriendly(video.NameVNI); videoSrv.CreateNew(video); videoSrv.CommitChanges(); Messages.AddFlashMessage("Thêm mới thành công."); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Video - Create", "Create Video Success", LogType.Success, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); return(RedirectToAction("Index")); } catch (Exception ex) { logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Video - Create", "Create Video Error : " + ex, LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); Messages.AddErrorMessage("Có lỗi xảy ra, vui lòng thực hiện lại."); IVideoTypeService videoTypeSrv = IoC.Resolve <IVideoTypeService>(); VideoModels model = new VideoModels(); model.Video = video; model.VideoTypes = videoTypeSrv.Query.Where(p => p.Active).OrderBy(p => p.NameVNI).ThenBy(p => p.NameENG).ToList(); return(View(model)); } }
public ModeratorController(IPagesService pageService, IUsersService usersService, ILogService logsService, IVideosService videosService, IPicturesService picturesService, IPostsService postsService, UserManager <User> userManager) { this.pageService = pageService; this.usersService = usersService; this.logsService = logsService; this.videosService = videosService; this.picturesService = picturesService; this.postsService = postsService; this.userManager = userManager; }
public TransferService( IYoutubeProvider youtubeProvider, ILogger <TransferService> logger, string outputFolder, IChannelsService channelsService, IVideosService videosService, IPlaylistsService playlistsService, IVideoObfuscateService videoObfuscateService, int threshold) : base(youtubeProvider, logger) { this.outputFolder = outputFolder; this.channelsService = channelsService; this.videosService = videosService; this.playlistsService = playlistsService; this.videoObfuscateService = videoObfuscateService; this.threshold = threshold; }
public static List <VideoInfo> VideoInfo_SelectPage(VideoSearchInfo search, int pageIndex, int pageSize, out int rowCount) { IVideosService channel = Entity.CreateChannel <IVideosService>(SiteEnum.SiteService.VideoService); VideoInfo_SelectPageRequest request = new VideoInfo_SelectPageRequest() { cloumns = "*", orderBy = search.DefaultOrder, pageIndex = pageIndex, pageSize = pageSize, where = search.ToWhereString() }; var result = channel.VideoInfo_SelectPage(request); (channel as IDisposable).Dispose(); rowCount = result.rowCount; return(result.VideoInfo_SelectPageResult); }
public async Task DeleteVideoByIdAsync_WithInvalidVideoId_ShouldThrowArgumentException() { //Arrange var expectedErrorMessage = "Video with the given id doesn't exist!"; var moqPictureService = new Mock <IPicturesService>(); var moqUsersService = new Mock <IUsersService>(); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); //Act and assert var ex = await Assert.ThrowsAsync <ArgumentException>(() => this.videosService.DeleteVideoByIdAsync(1)); Assert.Equal(expectedErrorMessage, ex.Message); }
public async Task GetCountOfAllVideosAsync_WithValidData_ShouldReturnCorrectCount() { //Arrange var expectedResult = 5; var moqPictureService = new Mock <IPicturesService>(); var moqUsersService = new Mock <IUsersService>(); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); var testingVideos = new List <Video> { new Video { Id = 1, Title = "Video1", IsDeleted = false, Link = "link1" }, new Video { Id = 2, Title = "Video2", IsDeleted = false, Link = "link2" }, new Video { Id = 3, Title = "Video3", IsDeleted = false, Link = "link3" }, new Video { Id = 4, Title = "Video4", IsDeleted = false, Link = "link4" }, new Video { Id = 5, Title = "Video5", IsDeleted = true, Link = "link5" }, }; await db.Videos.AddRangeAsync(testingVideos); await db.SaveChangesAsync(); //Act var actual = await this.videosService.GetCountOfAllVideosAsync(); //Assert Assert.Equal(expectedResult, actual); }
public YoutubeBooster( IYoutubeBoostProvider youtubeProvider, ILogger <YoutubeBooster> logger, IChannelsService channelsService, IVideosService videosService, Instagram.Services.Transfer.Services.IChannelsService instagramChannelsService, YoutubeOnYoutubeBooster youtubeBooster, YoutubeOnInstagramBooster instagramBooster, YoutubeOnFacebookBooster facebookBooster) { this.youtubeProvider = youtubeProvider; this.logger = logger; this.channelsService = channelsService; this.instagramChannelsService = instagramChannelsService; this.videosService = videosService; this.youtubeBooster = youtubeBooster; this.instagramBooster = instagramBooster; this.facebookBooster = facebookBooster; }
public async Task GetCountOfAllVideosAsync_WithoutAnyVideos_ShouldReturnZero() { //Arrange var expectedResult = 0; var moqPictureService = new Mock <IPicturesService>(); var moqUsersService = new Mock <IUsersService>(); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); //Act var actual = await this.videosService.GetCountOfAllVideosAsync(); //Assert Assert.Equal(expectedResult, actual); }
public PostsService(IDeletableEntityRepository <Post> postRepository, IImagesService imagesService, ICameraService cameraService, ILocationsService locationsService, ICountriesService countriesService, ITagsService tagsService, IReactionService reactionService, IVideosService videosService, IDeletableEntityRepository <PostType> postTypeRepository, IDeletableEntityRepository <PostTag> postTagsRepository) { this.imagesService = imagesService; this.postRepository = postRepository; this.cameraService = cameraService; this.locationsService = locationsService; this.countriesService = countriesService; this.tagsService = tagsService; this.reactionService = reactionService; this.videosService = videosService; this.postTypeRepository = postTypeRepository; this.postTagsRepository = postTagsRepository; }
public async Task CreateVideoAsync_WithValidData_ShouldCreateCorrectVideo() { //Arrange var expectedResult = 1; var moqPictureService = new Mock <IPicturesService>(); moqPictureService.Setup(x => x.GetPictureByLinkAsync("pictureLink")) .ReturnsAsync(new Picture { Id = 1, Name = "PictureName", }); var moqUsersService = new Mock <IUsersService>(); var option = new DbContextOptionsBuilder <ChessDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var db = new ChessDbContext(option); this.videosService = new VideosService(db, moqPictureService.Object, mapper, moqUsersService.Object); var inputModel = new AddVideoInputModel { VideoTitle = "VideoTitle", VideoLink = "VideoLink" }; //Act await this.videosService.CreateVideoAsync(inputModel); var video = db.Videos.First(); //Assert Assert.Equal("VideoTitle", video.Title); Assert.Equal("VideoLink", video.Link); }
public VideosController(IMapper mapper, IRepository <ArchiveVideo> repository, IOptions <ApiSettings> apiSettings, GetOEmbedVideoService getOEmbedVideoService, GetVideoService getVideoService, DeleteVideoService deleteVideoService, UploadSubtitleToVideoService uploadSubtitleToVideoService, IMarkdownService markdownService, CreateAnimatedThumbnailsService createAnimatedThumbnailsService, GetAllAnimatedThumbnailService getAllAnimatedThumbnailService, IVideosService videosService) { _mapper = mapper; _getOEmbedVideoService = getOEmbedVideoService; _getVideoService = getVideoService; _deleteVideoService = deleteVideoService; _uploadSubtitleToVideoService = uploadSubtitleToVideoService; _repository = repository; _expectedApiKey = apiSettings.Value.ApiKey; _markdownService = markdownService; _createAnimatedThumbnailsService = createAnimatedThumbnailsService; _getAllAnimatedThumbnailService = getAllAnimatedThumbnailService; _videosService = videosService; }
public VideoController() { _videosService = ServicesFactory.GetVideoServices(); }
public StatisticsService(IUsersService usersService, IGamesService gamesService, IVideosService videosService) { this.usersService = usersService; this.gamesService = gamesService; this.videosService = videosService; }
public MainPageViewModel( IPageNavigationService pageNavigationService, IItemsService dataService, ITweetsService tweetsService, IVideosService youtubeChannelService, ISettingsService settingsService, IUnityContainer unityContainer, IItemsRepository itemsRepository, ITweetsRepository tweetsRepository, IImagesRepository imagesRepository, IVideosRepository videosRepository, ICarsRepository carsRepository, IFlickrService flickrService, ISharingService sharingService) : base( sharingService, pageNavigationService, unityContainer) { _pageNavigationService = pageNavigationService; _dataService = dataService; _tweetsService = tweetsService; _youtubeChannelService = youtubeChannelService; _unityContainer = unityContainer; _itemsRepository = itemsRepository; _tweetsRepository = tweetsRepository; _imagesRepository = imagesRepository; _videosRepository = videosRepository; _flickrService = flickrService; _carsRepository = carsRepository; //CarModelsCollection = carsRepository.GetAll(); #if WINDOWS_PHONE if (DesignerProperties.IsInDesignTool) #else // !WINDOWS_PHONE if (DesignMode.DesignModeEnabled) #endif { //InitializeDataForDesignMode(); InitializeDataFromOnlineAsync(); } }