/// <summary> /// Preencho o repositório com as HQs novas /// </summary> public void Dump(IComicRepository comicRepository, IAuthorRepository authorRepository, IGenreRepository genreRepository, IPublisherRepository publisherRepository, ILogRepository logRepository) { //Se já processei nesse período, retorno DateTime lastSyncDate = logRepository.GetLastComicListUpdate(); if (lastSyncDate.AddHours(24) > DateTime.Now) return; //Espero terminar de processar while (_working) Thread.Sleep(10); //Busco todas as HQs do banco IList<Comic> repoList = comicRepository.Read(); //Comparo o que mudou foreach (ComicVisitor cacheComic in _cache) { if (repoList.Any(c => c.ComicName.ToUpper().Equals(cacheComic.ComicName.ToUpper()))) continue; //Se tem uma HQ nova, adiciono Comic dbComic = ComicVisitor.ToComic(cacheComic); comicRepository.Add(dbComic); cacheComic.ComicId = dbComic.ComicId; } comicRepository.Save(); logRepository.SetLastComicListUpdate(DateTime.Now); }
public UserComicService(IUserComicRepository repository, IComicRepository comicRepository, IUnitOfWork unitOfWork) { _repository = repository; _comicRepository = comicRepository; _unitOfWork = unitOfWork; }
public MarvelQuery( ICharacterRepository characterRepository, IComicRepository comicRepository, IEventRepository eventRepository, ISerieRepository serieRepository) { Field <CharacterType>( "character", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "marvelId" }), resolve: context => characterRepository.Get(context.GetArgument <int>("marvelId"))); Field <CharacterType>( "characters", resolve: context => characterRepository.GetAll()); Field <ListGraphType <ComicType> >( "comics", resolve: context => comicRepository.GetAll()); Field <EventType>( "events", resolve: context => eventRepository.GetAll()); Field <SerieType>( "series", resolve: context => serieRepository.GetAll()); }
public void Setup() { _comics = new TestData().Comics(); _comicRepository = MockRepository.MockComicRepository(_comics); _unitOfWork = new Mock <IUnitOfWork>().Object; _comicService = new ComicService(_comicRepository, _unitOfWork); }
public ComicController() { DbContext sharedContext = new Data.ComiczillaDb(); _repository = new ComicRepository(sharedContext); _authorRepository = new AuthorRepository(sharedContext); _genreRepository = new GenreRepository(sharedContext); _publisherRepository = new PublisherRepository(sharedContext); _chapterRepository = new ChapterRepository(sharedContext); _logRepository = new LogRepository(sharedContext); }
public ComicController(IComicRepository repository, IAuthorRepository authorRepository, IGenreRepository genreRepository, IPublisherRepository publisherRepository, IChapterRepository chapterRepository, ILogRepository logRepository) { _repository = repository; _authorRepository = authorRepository; _genreRepository = genreRepository; _publisherRepository = publisherRepository; _chapterRepository = chapterRepository; _logRepository = logRepository; }
public ComicController(ComicsDbContext context, UserManager <User> userManager, ComicsDbContext db, IWebHostEnvironment appEnviroment, IComicRepository comicRepository, ICommentsRepository commentRepository, IUserRepository userRepository, ImageManagment imageManagment, IHubContext <UpdateHub> updateHub) { _context = context; _userManager = userManager; _db = db; _appEnviroment = appEnviroment; _comicRepository = comicRepository; _commentRepository = commentRepository; _userRepository = userRepository; _imageManagment = imageManagment; _updateHub = updateHub; }
public void Setup() { _comics = new TestData().Comics(); _series = new TestData().Series(); _userComics = new TestData().UserComics(); _userSeries = new TestData().UserSeries(); _userComicRepository = MockRepository.MockUserComicRepository(_userComics); _userSeriesRepository = MockRepository.MockUserSeriesRepository(_userSeries); _comicRepository = MockRepository.MockComicRepository(_comics); _seriesRepository = MockRepository.MockSeriesRepository(_series); _unitOfWork = new Mock <IUnitOfWork>().Object; _userComicService = new UserComicService(_userComicRepository, _comicRepository, _unitOfWork); _service = new UserSeriesService(_userComicService, _userSeriesRepository, _seriesRepository, _unitOfWork); }
/// <summary> /// Recebe o repositório do Crawler e inicia a thread de pesquisa /// </summary> public void Start(IComicRepository comicCrawler, IChapterRepository chapterCrawler) { if (Started) return; _comicCrawler = comicCrawler; _chapterCrawler = chapterCrawler; _cache = new List<ComicVisitor>(); _watcherThread = new Thread(Watch); _watcherThread.Start(); Started = true; }
public MarvelMutation(IComicRepository comicRepository) { Name = "MarvelMutation"; Field <ComicType>( "createComic", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <ComicInputType> > { Name = "comic" } ), resolve: context => { var comic = context.GetArgument <Comic>("comic"); return(comicRepository.Add(comic)); }); }
public CharacterType( IComicRepository comicRepository, IEventRepository eventRepository, ISerieRepository serieRepository) { Field(x => x.Id, type: typeof(IdGraphType)); //https://github.com/graphql-dotnet/graphql-dotnet/issues/350 Field(x => x.Name); Field(x => x.MarvelId); Field(x => x.Description, nullable: true); Field(x => x.Thumbnail, nullable: true); Field(x => x.Modified); Field <ListGraphType <ComicType> >("comics", resolve: context => comicRepository.GetByCharacter(context.Source.Id)); Field <ListGraphType <EventType> >("events", resolve: context => eventRepository.GetByCharacter(context.Source.Id)); Field <ListGraphType <SerieType> >("series", resolve: context => serieRepository.GetByCharacter(context.Source.Id)); }
/// <summary> /// Preencho a HQ com a id passada /// </summary> public async void Dump(IComicRepository comicRepository, IAuthorRepository authorRepository, IGenreRepository genreRepository, IPublisherRepository publisherRepository, IChapterRepository chapterRepository, ILogRepository logRepository, int id) { //Se já processei nesse período, retorno DateTime lastSyncDate = logRepository.GetLastComicListUpdate(); if (lastSyncDate.AddHours(24) > DateTime.Now) return; //Espero terminar de processar while (_working) Thread.Sleep(10); //Busco a HQ do repositório Comic dbComic = comicRepository.Get(id); //Se não tem no repositório, retorno if (dbComic == null) return; //Busco a HQ do cache ComicVisitor cacheComic = _cache.FirstOrDefault(c => c.ComicUrl == dbComic.ComicUrl); //Se não existe a HQ no cache ou já foi processada, retorno if (cacheComic == null) return; if (cacheComic.ComicState != ComicState.Empty) return; cacheComic.ComicId = id; //Se não processei a HQ ainda //Preencho a HQ cacheComic.ComicState = ComicState.Working; cacheComic = (ComicVisitor)_comicCrawler.Edit(cacheComic); AddAuthor(dbComic, authorRepository, cacheComic.DirtyStateAuthor); AddGenre(dbComic, genreRepository, cacheComic.DirtyStateGenre); AddPublisher(dbComic, publisherRepository, cacheComic.DirtyStatePublisher); AddChapters(id, chapterRepository, cacheComic.Chapters); //Libero a HQ cacheComic.ComicState = ComicState.Visited; }
public GetComics(IComicRepository comicRepository) { ComicRepository = comicRepository; }
public AppController(IComicRepository repository) { _comicRepository = repository; }
public ComicService(IComicRepository comicRepository, IUnitOfWork unitOfWork) { _comicRepository = comicRepository; _unitOfWork = unitOfWork; }
public ComicsController(IComicRepository comicRepository) { _comicRepository = comicRepository; }
public GetTodaysComics(IComicRepository comicRepository) { ComicRepository = comicRepository; }
public ComicService(IComicRepository repository, IMapper mapper) : base(repository, mapper) { _comicRepository = repository; }
public ComicService(IComicRepository comicRepository) { _comicRepository = comicRepository; }
public ComicUseCase( IComicRepository comicRepository) { _comicRepository = comicRepository; }
public Vote(IComicRepository comicRepository) { ComicRepository = comicRepository; }
public RevistasAjaxController(IComicRepository repo, IHostingEnvironment e) { _repo = repo; this.he = e; }
public RevistasController(IComicRepository repo) { _repo = repo; }
public ComicsController(IComicRepository repo, IMapper mapper) { _mapper = mapper; _repo = repo; }