예제 #1
0
 public BooksController()
 {
     BookModelContainer db = new BookModelContainer();
     this.bookRepository = new BookRepository(db);
     this.authorRepository = new AuthorRepository(db);
     this.categoryRepository = new CategoryRepository(db);
 }
예제 #2
0
        /// <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);
        }
예제 #3
0
 public HomeController(IIngredientRepository ingredientRepository, IRecipeRepository recipeRepository, IDietRepository dietRepository, IAuthorRepository authorRepository, ICommentRepository commentRepository)
 {
     _ingredientRepository = ingredientRepository;
     _recipeRepository = recipeRepository;
     _dietRepository = dietRepository;
     _authorRepository = authorRepository;
     _commentRepository = commentRepository;
 }
 public BookOrchestration(IBookRepository bookRepository,
     IAuthorRepository authorRepository,
     IGenreRepository genreRepository)
 {
     _bookRepository = bookRepository;
     _authorRepository = authorRepository;
     _genreRepository = genreRepository;
 }
        public AuthorControllerTests()
        {
            autoMapperConfiguration = new AutoMapperConfiguration();
            autoMapperConfiguration.Configure();
            fixture = new Fixture().Customize(new AutoFixtureCustomization());

            mocks = new MockRepository();
            authorRepositoryMock = mocks.DynamicMock<IAuthorRepository>();
            controller = new AuthorController(authorRepositoryMock);
        }
예제 #6
0
        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);
        }
예제 #7
0
 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;
 }
예제 #8
0
 public BooksController(IUnitOfWork<BooksContext> unitOfWork, 
     IBooksRepository repo, 
     ICategoryRepository categoryRepository, 
     IBookBadgeRepository badgeRepo,
     IAuthorRepository authorRepo)
 {
     _categoryRepository = categoryRepository;
     _unitOfWork = unitOfWork;
     _repo = repo;
     _badgeRepo = badgeRepo;
     _authorRepo = authorRepo;
 }
예제 #9
0
 public MealController(IMealRepository mealRepository, IIngredientRepository ingredientRepository, IQuantityTypeRepository quantityTypeRepository, IIngredientCategoryRepository ingredientCategoryRepository, IMealIngredientRepository mealIngredientRepository, IMealCategoryRepository categoryRepository, IRecipeRepository recipeRepository, IUserRepository userRepository, IAuthorRepository authorRepository, IIngredientQuantityRepository ingredientQuantityRepository)
 {
     _mealRepository = mealRepository;
     _ingredientRepository = ingredientRepository;
     _quantityTypeRepository = quantityTypeRepository;
     _ingredientCategoryRepository = ingredientCategoryRepository;
     _mealIngredientRepository = mealIngredientRepository;
     _categoryRepository = categoryRepository;
     _recipeRepository = recipeRepository;
     _userRepository = userRepository;
     _authorRepository = authorRepository;
     _ingredientQuantityRepository = ingredientQuantityRepository;
 }
예제 #10
0
        public BookService(IBookRepository bookRepository, IAuthorRepository authorRepository)
        {
            if (bookRepository == null)
            {
                throw new ArgumentNullException(nameof(bookRepository));
            }

            if (authorRepository == null)
            {
                throw new ArgumentNullException(nameof(authorRepository));
            }

            _bookRepository = bookRepository;
            _authorRepository = authorRepository;
        }
예제 #11
0
 public MealControllerTest()
 {
     MapperConfig.ConfigureMapper();
     _mealRepository = new FakeMealRepository();
     _ingredientRepository = new FakeIngredientRepository();
     _quantityTypeRepository = new FakeQuantityTypeRepository();
     _ingredientCategoryRepository = new FakeIngredientCategoryRepository();
     _mealIngredientRepository = new FakeMealIngredientRepository();
     _mealCategoryRepository = new FakeMealCategoryRepository();
     _recipeRespository = new FakeRecipeRepository();
     _userRepository =  new FakeUserRepository();
     _authorRepository = new FakeAuthorRepository();
     _ingredientQuantityRepository = new FakeIngredientQuantityRepository();
     _controller = new MealController(_mealRepository, _ingredientRepository, _quantityTypeRepository, _ingredientCategoryRepository, _mealIngredientRepository, _mealCategoryRepository, _recipeRespository, _userRepository, _authorRepository, _ingredientQuantityRepository);
 }
예제 #12
0
 public AuthorController(IAuthorRepository authorRepository, IUnitOfWork<BooksContext> unitOfWork)
 {
     _authorRepository = authorRepository;
     _unitOfWork = unitOfWork;
 }
 public AuthorListController()
 {
     _authorRepository = new AuthorRepository();
 }
예제 #14
0
        public AuthorViewModule(IAuthorRepository repository)
            : base("/authors")
        {
            //redirects
            Get["/"] = _ => Response.AsRedirect("~/homeWithStylishMaster");

            //dynamic view with expando object
            Get["/all"] = _ => {
                var allAuthors = repository.GetAll();

                dynamic model = new ExpandoObject();
                model.HasAuthors = allAuthors.Any();
                model.Authors = allAuthors;

                return View["authors/all", model];
            };

            //dynamic view with partials
            Get["/search"] = _ =>
            {
                dynamic authorName = this.Request.Query.authorName;

                IList<Author> foundAuthors = null;
                if (authorName.HasValue && ((string)authorName).Trim() != "")
                {
                    foundAuthors = repository.GetByAuthorName(authorName);

                }
                else
                {
                    foundAuthors = repository.GetAll();
                }

                dynamic model = new ExpandoObject();
                model.HasAuthors = foundAuthors.Any();
                model.Authors = foundAuthors;

                return View["authors/search", model];
            };

            //post data and bind model
            Get["/addAuthor"] = _ =>
            {
                dynamic model = new ExpandoObject();
                model.HasMessage = false;
                AddAuthorsToModel(model, repository.GetAll());
                return View["authors/addAuthor", model];
            };

            Post["/addAuthor"] = _ => {
                Author postedAuthor = this.Bind<Author>();
                Logger.Debug(string.Format("[{0}] postedAuthor was {1}", this.Request.Url, postedAuthor));

                var newAuthorId = repository.Save(postedAuthor);
                dynamic model = new ExpandoObject();
                if (newAuthorId == null)
                {
                    model.HasMessage = true;
                    model.Message = "Author was not saved";
                    model.MessageStyle = "color:red;";
                }
                else
                {
                    model.HasMessage = true;
                    model.Message = "Author was saved with Id " + newAuthorId;
                    model.MessageStyle = "";
                }

                AddAuthorsToModel(model, repository.GetAll());

                return View["authors/addAuthor", model];
            };
        }
예제 #15
0
 public AuthorService(IMapper map, IAuthorValidator validator, IAuthorRepository repo)
 {
     mapper          = map;
     authorValidator = validator;
     repository      = repo;
 }
예제 #16
0
 public AuthorService()
 {
     _authorRepozitory = new AuthorRepository();
 }
예제 #17
0
 public AuthorService(IAuthorRepository AuthorRepository) : base(AuthorRepository)
 {
     _AuthorRepository = AuthorRepository;
 }
예제 #18
0
 public AuthorsController(IAuthorRepository author, ILoggerService logger, IMapper map)
 {
     this.authorRepository = author;
     this.loggerService    = logger;
     this.mapper           = map;
 }
예제 #19
0
 public AuthorController(IAuthorRepository repo)
 {
     authorRepo = repo;
 }
예제 #20
0
 public AuthorManager(IAuthorRepository authorRepository)
 {
     _authorRepository = authorRepository;
 }
 public GetAllAuthorsQueryHandler(IAuthorRepository authorRepository)
 {
     this.authorRepository = authorRepository;
 }
 public UpdateAuthorCommandHandler(IAuthorRepository authorRepo, ClaimsPrincipal user)
 {
     this._authorRepo = authorRepo;
     this._user       = user;
 }
예제 #23
0
 public LibraryUOW(IAuthorRepository authorRepository, IBookRepository bookRepository, ISerieRepository serieRepository)
 {
     this.authorRepository = authorRepository;
     this.bookRepository   = bookRepository;
     this.serieRepository  = serieRepository;
 }
예제 #24
0
 public AuthorService(IAuthorRepository authorRepository, ILogService logService)
 {
     _authorRepository = authorRepository;
     _logService       = logService;
 }
예제 #25
0
 public AuthorDetailQueryHandler(IAuthorRepository authorRepo)
 {
     this._authorRepo = authorRepo;
 }
예제 #26
0
 public AuthorsController(IAuthorRepository authorRepository, ILoggerService logger, IMapper mapper)
 {
     _authorRepository = authorRepository;
     _logger           = logger;
     _mapper           = mapper;
 }
예제 #27
0
 public AuthorsController(IAuthorRepository repository)
 {
     _repository = repository;
 }
예제 #28
0
 public LibraryService(IBookRepository bookRepository, IAuthorRepository authorRepository, IMagazineRepository magazineRepository)
 {
     _bookRepository     = bookRepository;
     _authorRepository   = authorRepository;
     _magazineRepository = magazineRepository;
 }
예제 #29
0
 /// <summary>
 /// Overrides the default constructor.  Uses dependency injection to instantiate repositories.
 /// </summary>
 public AuthorController(IAuthorRepository repository)
 {
     this.repository = repository;
 }
 public AuthorController()
 {
     repository = new AuthorRepository();
 }
 public AuthorRepositoryTests()
 {
     repository = new AuthorRepository(UnitOfWork);
     fixture = new Fixture().Customize(new AutoFixtureCustomization());
 }
예제 #32
0
 public AuthorService(IAuthorRepository autorRepository)
 {
     _authorRepository = autorRepository;
 }
예제 #33
0
 public BookManager(IBookRepository bookRepository, IAuthorRepository authorRepository, IBookAuthorRepository bookAuthorRepository)
 {
     _bookRepository = bookRepository;
     _authorRepository = authorRepository;
     _bookAuthorRepository = bookAuthorRepository;
 }
예제 #34
0
 public AuthorValidator(IAuthorRepository repo, IAuthorValidationRules authorValidation)
 {
     repository            = repo;
     authorValidationRules = authorValidation;
 }
예제 #35
0
 public AuthorPagingQueryHandler(IAuthorRepository authorRepo)
 {
     this._authorRepo = authorRepo;
 }
 public BookStoreDataSeedContributor(IRepository <Book, Guid> bookRepository, IAuthorRepository authorRepository, AuthorManager authorManager)
 {
     _bookRepository   = bookRepository;
     _authorRepository = authorRepository;
     _authorManager    = authorManager;
 }
예제 #37
0
 public static IAuthorService GetAuthorService(IAuthorRepository repository, IAuthorValidation validation)
 {            
     return new AuthorService(repository, validation);
 }
예제 #38
0
 public AuthorService(IMapper mapper, IAuthorRepository authorRepository)
 {
     _mapper           = mapper;
     _authorRepository = authorRepository;
 }
예제 #39
0
 public BookDomainModel(IAuthorRepository authorRepository, IBookRepository bookRepository)
 {
     BookRepository = bookRepository;
     AuthorRepository = authorRepository;
 }
예제 #40
0
 public AuthorDomain()
 {
     _authorRepository = new AuthorRepository();
 }
예제 #41
0
 public AuthorsController(IAuthorRepository _authorRepository)
 {
     authorRepository = _authorRepository;
 }
예제 #42
0
 public AuthorService(IAuthorRepository authorRepository)
 {
     this.authorRepository = authorRepository;
 }
예제 #43
0
 public AuthorAppService(IAuthorRepository authorRepository, AuthorManager authorManager)
 {
     _authorRepository = authorRepository;
     _authorManager    = authorManager;
 }
예제 #44
0
 public AuthorController(IAuthorRepository repository, ILogger <AuthorController> logger)
 {
     _repository = repository;
     _logger     = logger;
 }
예제 #45
0
 public AuthorsController(IAuthorRepository authorRepository)
 {
     _authorRepository = authorRepository;
 }
예제 #46
0
 public AuthorsController(IBookRepository repository, IAuthorRepository authorRepository)
 {
     _bookRepository   = repository;
     _authorRepository = authorRepository;
 }
 public BloggingApplicationService(IAuthorRepository authorRepository, IPostRepository postRepository)
 {
     AuthorRepository = authorRepository;
     PostRepository = postRepository;
 }
예제 #48
0
 public AuthorProvider(IAuthorRepository authorRepository)
 {
     _authorRepository = authorRepository;
 }
예제 #49
0
 public AuthorController(IAuthorRepository repository)
 {
     _repository = repository;
 }
예제 #50
0
 public ArticleService(IArticleRepository articleRepository, IAuthorRepository authorRepository, ITagRepository tagRepository)
 {
     _articleRepository = articleRepository;
     _authorRepository  = authorRepository;
     _tagRepository     = tagRepository;
 }
 public AuthorController(IAuthorRepository authorRepository)
 {
     this.authorRepository = authorRepository;
 }
예제 #52
0
 public AuthorsController(IAuthorRepository authorRepository)
 {
     _authorRepository = authorRepository;
 }
예제 #53
0
 public AuthorService(IAuthorRepository authorRepository, IAuthorValidation authorValidation)
 {
     this.authorRepository = authorRepository;
     this.authorValidation = authorValidation;
 }
예제 #54
0
 public AuthorService(IAuthorRepository authorRepository, IBookRepository bookRepository)
 {
     _authorRepository = authorRepository;
     _bookRepository   = bookRepository;
 }
예제 #55
0
 public AuthorDomainModel(IAuthorRepository authorRepository)
 {
     AuthorRepository = authorRepository;
 }
예제 #56
0
 public AuthorController(IAuthorRepository authorRepository, IMapper mapper)
 {
     _authorRepository = authorRepository;
     _mapper           = mapper;
 }
 public BooksController(IBookRepository bookRepository, IAuthorRepository authorRepository)
 {
     _bookRepository = bookRepository;
     _authorRepository = authorRepository;
 }
예제 #58
0
 public BookController(IBookRepository bookRepository, IAuthorRepository authorRepository)
 {
     _bookRepository   = bookRepository;
     _authorRepository = authorRepository;
 }
예제 #59
0
 public UnitOfWork(BookServiceContext context)
 {
     this.context      = context;
     BooksRepository   = new BookRepository(context);
     AuthorsRepository = new AuthorRepository(context);
 }
예제 #60
0
 public IQueryable <Author> Authors([Service] IAuthorRepository authorRepository) => authorRepository.GetAuthors();