public ConfessionsController(IConfessionRepository repo, IMapper mapper, IUriRepository uriRepository, IUserRepository userRepo)
 {
     _userRepo      = userRepo;
     _repo          = repo;
     _mapper        = mapper;
     _uriRepository = uriRepository;
 }
        public static PageDto <List <T> > CreatePagedReponse <T>(List <T> pagedData, PaginationFilter validFilter, int totalRecords, IUriRepository uriService, string route)
        {
            var respose           = new PageDto <List <T> >(pagedData, validFilter.PageNumber, validFilter.PageSize);
            var totalPages        = ((double)totalRecords / (double)validFilter.PageSize);
            int roundedTotalPages = Convert.ToInt32(Math.Ceiling(totalPages));

            respose.NextPage =
                validFilter.PageNumber >= 1 && validFilter.PageNumber < roundedTotalPages
                ? uriService.GetPageUri(new PaginationFilter(validFilter.PageNumber + 1, validFilter.PageSize), route)
                : null;

            respose.PreviousPage =
                validFilter.PageNumber - 1 >= 1 && validFilter.PageNumber <= roundedTotalPages
                ? uriService.GetPageUri(new PaginationFilter(validFilter.PageNumber - 1, validFilter.PageSize), route)
                : null;

            respose.FirstPage    = uriService.GetPageUri(new PaginationFilter(1, validFilter.PageSize), route);
            respose.LastPage     = uriService.GetPageUri(new PaginationFilter(roundedTotalPages, validFilter.PageSize), route);
            respose.TotalPages   = roundedTotalPages;
            respose.TotalRecords = totalRecords;
            return(respose);
        }
Exemple #3
0
 public UserController(IUserRepository userRepository, IUriRepository uriRepository)
 {
     _userRepository = userRepository;
     _uriRepository  = uriRepository;
 }
Exemple #4
0
 public ShortUrlServices(IUriRepository repository)
 {
     shortUrlRepository = repository;
 }
Exemple #5
0
 public SqlServerUserRepository(BookStoreDbContext bookStoreDbContext, IUriRepository uriRepository)
 {
     _bookStoreDbContext = bookStoreDbContext;
     _uriRepostory       = uriRepository;
 }