public GetAuthorsListQueryHandler(
     IAuthorRepo authorRepo,
     IMapper mapper)
 {
     _authorRepo = authorRepo;
     _mapper     = mapper;
 }
Example #2
0
 public Handler(
     IAuthorRepo authorRepo,
     IMediator mediator)
 {
     _authorRepo = authorRepo;
     _mediator   = mediator;
 }
 public SQLPostRepo(IAuthorRepo authorRepo, IConfiguration config)
 {
     _authorRepo          = authorRepo;
     _sqlConnectionString = config["SQLConnectionString"];
     _connection          = new SqlConnection(_sqlConnectionString);
     _connection.Open();
 }
Example #4
0
 public PostDataAccess(IPostRepo postRepo, IPostValidator postValidator, IAuthorRepo authorRepo, IAuthorValidator authorValidator)
 {
     _postRepo        = postRepo;
     _postValidator   = postValidator;
     _authorRepo      = authorRepo;
     _authorValidator = authorValidator;
 }
 public BookService(IAuthorRepo repo, IBookRepo repoForBook, IUnitOfWork unitOfWork, IReadModelDatabase database)
 {
     _database    = database;
     _repo        = repo;
     _repoForBook = repoForBook;
     _unitOfWork  = unitOfWork;
 }
Example #6
0
 public AuthorsController(IAuthorRepo authorRepo)
 {
     _authorRepo         = authorRepo;
     _serializerSettings = new JsonSerializerSettings
     {
         Formatting = Formatting.Indented
     };
 }
Example #7
0
        public AuthorListViewModel(IAuthorRepo authorRepo)
        {
            this.authorRepo = authorRepo;

            Initialize();

            AddAuthorCommand    = new DelegateCommand <Author>(OnAddAuthor);
            EditAuthorCommand   = new DelegateCommand <Author>(OnEditAuthor, CanAuthor);
            DeleteAuthorCommand = new DelegateCommand(OnDeleteAuthor, CanAuthor);
        }
        public void Setup()
        {
            IList <Author> author = new List <Author> {
                new Author {
                    authorid = 1, authorimage = "ericks image", authorname = "erick roberts", userid = 1
                },
                new Author {
                    authorid = 2, authorimage = "sams image", authorname = "Sam roberts", userid = 2
                },
                new Author {
                    authorid = 3, authorimage = "Annas image", authorname = "anna roberts", userid = 3
                },
                new Author {
                    authorid = 4, authorimage = "anna image", authorname = "aaron roberts", userid = 4
                },
                new Author {
                    authorid = 5, authorimage = "luke image", authorname = "luke roberts", userid = 5
                }
            };

            var mockrepo = new Mock <IAuthorRepo>();

            // add method
            mockrepo.Setup(m => m.Add(It.IsAny <Author>()))
            .Callback <Author>(a => author.Add(a));
            // find all method
            mockrepo.Setup(m => m.FindAll()).Returns(author);

            // find by id method
            mockrepo.Setup(m => m.FindByID(It.IsAny <int>()))
            .Returns((int i) => author
                     .Where(w => w.authorid == i).Single());

            // update method
            mockrepo.Setup(m => m.Update(It.IsAny <Author>()))
            .Callback <Author>(p => author.Where(w => w.authorid == p.authorid).First(a => { a.authorimage = p.authorimage; a.authorname = p.authorname; return(true); }));

            // remove method

            mockrepo.Setup(m => m.Remove(It.IsAny <int>()))
            .Callback <int>(i => author.Remove(author.Where(w => w.authorid == i).First()));

            _mockrepo = mockrepo.Object;
        }
 public AuthorService(IMapper mapper, IAuthorRepo repo) : base(mapper, repo)
 {
 }
Example #10
0
 public AuthorsController(ILogger <AuthorsController> log, IAuthorRepo repo)
 {
     authorRepo = repo;
     _log       = log;
 }
Example #11
0
 public AuthorController(IAuthorRepo authorRepo)
 {
     _authorRepo = authorRepo;
 }
Example #12
0
 public AuthorsController(IAuthorRepo repo, IMapper mapper)
 {
     _repo   = repo;
     _mapper = mapper;
 }
Example #13
0
 public AuthorsController(IAuthorRepo _authorRepo)
 {
     this.authorRepo = _authorRepo;
 }
 public AuthorController(IAuthorRepo authorRepo, IMapper mapper, IAuthorService service)
 {
     _service    = service;
     _mapper     = mapper;
     _authorRepo = authorRepo;
 }
 public AuthorValidator(IAuthorRepo authorRepo) => _authorRepo = authorRepo;
Example #16
0
 public RegisterController(IAuthorRepo authorRepo)
 {
     _authorRepo = authorRepo;
 }
Example #17
0
 public AuthorService(IAuthorRepo authorRepo)
 {
     _authorRepo = authorRepo;
 }
Example #18
0
 public LoginController(IAuthorRepo authorRepo) => _authorRepo = authorRepo;