public MainForm() { video = new VideoRepository(new VideoSQLiteContext()); myVideos = video.GetVideosByUser((User)AccountRepository.LoggedUser); InitializeComponent(); }
public static async Task GetVideos(VideoRepository videoRepo) { #if WINDOWS_APP StorageLibrary videoLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Videos); foreach (StorageFolder storageFolder in videoLibrary.Folders) #else StorageFolder storageFolder = KnownFolders.VideosLibrary; #endif { try { IReadOnlyList <StorageFile> files = await GetMediaFromFolder(storageFolder); await AddVideo(videoRepo, files, false); } catch { LogHelper.Log("An error occured while indexing a video folder"); } } if (Locator.VideoLibraryVM.Videos.Count > 0) { await DispatchHelper.InvokeAsync(() => Locator.VideoLibraryVM.HasNoMedia = false); } else { await DispatchHelper.InvokeAsync(() => Locator.VideoLibraryVM.HasNoMedia = true); } await App.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { Locator.VideoLibraryVM.LoadingState = LoadingState.Loaded; }); }
public void DeleteOneVideo() { Video videoDelete = new Video { Id = 3, Name = "Deporte", Author = "Pepe", Hour = 0, MinSeconds = 3.1, LinkVideo = "www.youtube.com/deportePepe" }; listVideo.Add(videoDelete); var options = new DbContextOptionsBuilder <BetterCalmContext>() .UseInMemoryDatabase(databaseName: "MSP.BetterCalmDatabase").Options; var context = new BetterCalmContext(options); listVideo.ForEach(video => context.Add(video)); context.SaveChanges(); repository = new VideoRepository(context); repository.Delete(videoDelete); context.Database.EnsureDeleted(); Video getVideo = repository.Get(3); Assert.AreEqual(null, getVideo); }
public HistoryRepositoryTests() { _context = new PartyTubeDbContextMock(); _appSettings = new AppSettings(); _videoRepository = new VideoRepository(_context.Context); _historyRepository = new HistoryRepository(_context.Context, _appSettings, _videoRepository); }
public ActionResult UploadFile() { var httpPostedFile = Request.Files[0]; if (httpPostedFile != null) { // Validate the uploaded file if you want like content length(optional) // Get the complete file path /* var uploadFilesDir = System.Web.HttpContext.Current.Server.MapPath("~/Videos"); * if (!Directory.Exists(uploadFilesDir)) * { * Directory.CreateDirectory(uploadFilesDir); * } * var fileSavePath = Path.Combine(uploadFilesDir, httpPostedFile.FileName);*/ // Save the uploaded file to "UploadedFiles" folder // httpPostedFile.SaveAs(fileSavePath); VideoRepository rep = new VideoRepository(); rep.Add(httpPostedFile); } return(RedirectToAction("Index"));//Content("Uploaded Successfully"); }
public UnitOfWork(PlutoContext context) { _context = context; Customer = new CustomerRepository(context); Video = new VideoRepository(context); Rental = new VideoRentalRepository(context); }
public new ActionResult Profile(long?id) { if (id == null && (Session["UserID"] == null || string.IsNullOrEmpty(Session["UserID"].ToString()))) { return(RedirectToAction("SignIn", "User")); } var model = new ProfileViewModel(); var _videoRepo = new VideoRepository(); if (id != null) { model.User = _userRepo.GetUser((long)id); //if ( Session["UserID"] != null && id == (long)Session["UserID"]) //{ SqlCommand command = new SqlCommand() { CommandText = "spGetUserVideos", CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@id", model.User.UserID); model.Videos = _videoRepo.GetVideoList(command); //} } return(View(model)); }
public void GetPercentageOfVideosWatchedInSequence_WithVideosInSpecifiedSequence() { var videoRepository = new VideoRepository(); var sequence1 = CreateAndRetrievePlaylist(); var sequence2 = CreateAndRetrievePlaylist(); var videoDto = CreateVideoUtil.GetNewVideoDetails(testLibrary.LibraryId, -1, -1); videoDto.TimesWatched = 1; var videoId = videoRepository.CreateVideo(videoDto); repository.AddVideoToSequence(videoId, sequence1.SequenceId); videoDto = CreateVideoUtil.GetNewVideoDetails(testLibrary.LibraryId, -1, -1); videoId = videoRepository.CreateVideo(videoDto); repository.AddVideoToSequence(videoId, sequence1.SequenceId); videoDto = CreateVideoUtil.GetNewVideoDetails(testLibrary.LibraryId, -1, -1); videoDto.TimesWatched = 1; videoId = videoRepository.CreateVideo(videoDto); repository.AddVideoToSequence(videoId, sequence2.SequenceId); var percentWatched = repository.GetPercentageOfVideosWatchedInSequence(sequence1.SequenceId); Assert.AreEqual(50, percentWatched); }
// GET: InstrutorVideo public ActionResult Index(int id) { var repo = new VideoRepository(); var lista = repo.ListarTotalVideoPorCapitulo(id); return(View(lista)); }
public UnitOfWorkMem() { context = new VideoAppContext(); context.Database.EnsureCreated(); VideoRepository = new VideoRepository(context); GenreRepository = new GenreRepository(context); }
protected void btnSearch_Click(object sender, EventArgs e) { // Sanitize input string string SanitizedInputString = Sanitizers.SanitizeSearchString(txtSearchTerms.Text); // Determine if the viewer is viewing from inside the network string clientIP = Request.ServerVariables["REMOTE_ADDR"]; bool canUserAccessPrivateContent = Config.CanAccessPrivate(clientIP); VideoRepository videoRepository = new VideoRepository(); List <Video> foundVideos = videoRepository.Find(SanitizedInputString, canUserAccessPrivateContent); searchResultsTitle.Visible = true; litSearchResults.Visible = true; if (foundVideos.Count > 0) { litSearchResults.Text = ""; foreach (Video video in foundVideos) { litSearchResults.Text += videoListItem(video); } } else { litSearchResults.Text = "No videos found matching the term '" + SanitizedInputString + "'"; } litCategories.Visible = false; litVideos.Visible = false; }
public PlayVideoResponse PlayVideo(PlayVideoRequest request) { var response = new PlayVideoResponse(); try { var user = ApplicationUserRepository.FindOne(u => u.Username == request.User); var video = VideoRepository.FindOne(v => v.Id == request.VideoId); if (user.Credits < video.RideCredits) { response.Status = PlayVideoStatus.InsufficientCredits; return(response); } user.Credits -= video.RideCredits; ApplicationUserRepository.Save(user); response.Credits = user.Credits; response.Status = PlayVideoStatus.Success; } catch (Exception ex) { response.Status = PlayVideoStatus.Error; response.Message = ex.Message; } return(response); }
public AddVideoResponse AddVideoToLibrary(AddVideoRequest request) { var response = new AddVideoResponse(); try { var user = ApplicationUserRepository.FindOne(u => u.Username == request.User); if (user.Videos.Any(x => x.Id == request.VideoId)) { response.AddVideoStatus = AddVideoStatus.VideoAlreadyAdded; return(response); } var video = VideoRepository.FindOne(v => v.Id == request.VideoId); if (user.Credits < video.Credits) { response.AddVideoStatus = AddVideoStatus.InsufficientCredits; return(response); } user.Credits -= video.Credits; user.Videos.Add(video); ApplicationUserRepository.Save(user); response.Credits = user.Credits; response.AddVideoStatus = AddVideoStatus.Success; } catch (Exception ex) { response.AddVideoStatus = AddVideoStatus.Error; response.Message = ex.Message; } return(response); }
public override int AddNewItem(Video video) { var itemInput = new GetItemByIdInput(); var barcodeInput = new SetItemBarcodeInput(); var updateInput = new UpdateItemInput(); var input = new VideoDto.AddNewVideoInput { Video = new VideoDto(video) }; using (var repo = new VideoRepository()) { var app = new VideoAppService(repo); itemInput.Id = app.AddNewVideo(input).Id; } using (var itemRepo = new ItemRepository()) { var app = new ItemAppService(itemRepo); var thisItem = app.GetItemById(itemInput); barcodeInput.Item = thisItem.Item; var barcodeOutput = app.SetItemBarcode(barcodeInput); thisItem.Item.Barcode = barcodeOutput.Barcode; updateInput.Item = thisItem.Item; app.UpdateItem(updateInput); } return(itemInput.Id); }
public UnitOfWork() { context = new VideoAppContext(); VideoRepository = new VideoRepository(context); OrderRepository = new OrderRepository(context); AddressRepository = new AddressRepository(context); }
public VideoController(VideoRepository videoRepository, VideoService videoService, IMapper mapper, PaginatedMetaService paginatedMetaService, FileHelper fileHelper) { _videoRepository = videoRepository; _videoService = videoService; _mapper = mapper; _paginatedMetaService = paginatedMetaService; _fileHelper = fileHelper; }
public static IVideoRepository Create() { var repo = new VideoRepository( CosmosDbAuthInfoFactory.Create() ); return(repo); }
/// <summary> /// Constructor of VideosConroller /// </summary> /// <param name="videoRepository">videoRepository</param> /// <param name="participantRepository">participantRepository</param> /// <param name="urlHelper">UrlHelper</param> /// <param name="propertyMappingService">propertyMappingService which helps to map the sort order of fields of model to the database field</param> /// <param name="typeHelperService">typehelper service which helps to know whether a property exists ina type</param> public VideosController(VideoRepository videoRepository, ParticipantRepository participantRepository, IUrlHelper urlHelper, IPropertyMappingService propertyMappingService, ITypeHelperService typeHelperService) { this.videoRepository = videoRepository; this.participantRepository = participantRepository; this.propertyMappingService = propertyMappingService; this.typeHelperService = typeHelperService; this.urlHelper = urlHelper; }
//delete public static async Task <List <VideoFeeds> > DeleteVideo(int VideoId) { using (VideoRepository rep = new VideoRepository()) { var response = await rep.DeleteVideo(VideoId); return(response); } }
public FileEventService( ConnectionMultiplexer redisMultiplexer, VideoRepository videoRepository, ILogger <FileEventService> logger) { _logger = logger; _videoRepository = videoRepository; _redisMultiplexer = redisMultiplexer; }
public ActionResult Detalhes(int id) { using (var repo = new VideoRepository()) { var Video = repo.Obter(id); return(View(Video)); } }
public ActionResult Excluir(Video Video) { using (var repo = new VideoRepository()) { repo.Excluir(Video); return(RedirectToAction("Index", "InstrutorCursos")); } }
public ActionResult Editar(Video Video) { using (var repo = new VideoRepository()) { Video = repo.Atualizar(Video); return(RedirectToAction("Index", new { id = Video.IdCapitulo })); } }
public static async Task <List <VideoFeeds> > GetAll() { using (VideoRepository rep = new VideoRepository()) { var VideoList = await rep.GetAllVideos(); return(VideoList); } }
//update public static async Task <List <VideoFeeds> > UpdateVideo(VideoFeeds video) { using (VideoRepository rep = new VideoRepository()) { var response = await rep.UpdateVideo(video); return(response); } }
public override IEnumerable <Video> GetAllItems() { using (var repo = new VideoRepository()) { var app = new VideoAppService(repo); var output = app.GetAllVideos(); return(output.Videos.Select(video => video.ConvertToVideo()).ToList()); } }
public ActionResult Criar() { VideoRepository capitulos = new VideoRepository(); Video video = new Video(); Video.Capitulo = capitulos.ListarCapitulo(); return(View(capitulos)); }
public ActionResult Criar(Video video) { VideoRepository curso = new VideoRepository(); video.Inserir(video); video.Capitulos = curso.ListarCapitulo(); return(View(video)); }
public UnitOfWork(DbContext context) { _context = context; RoleRepository = new RoleRepository(_context); UserRepository = new UserRepository(_context); GenreRepository = new GenreRepository(_context); VideoRepository = new VideoRepository(_context); ProfileRepository = new ProfileRepository(_context); RentalRepository = new RentalRepository(_context); }
public VideoStreamService( ILogger <VideoStreamService> logger, FileServer.FileServerClient fileServerClient, VideoRepository repo, ConnectionMultiplexer redisMultiplexer ) : base() { _logger = logger; _fileServerClient = fileServerClient; _repo = repo; _redisMultiplexer = redisMultiplexer; }