示例#1
0
 public ClinicService(
     IApiMapper mapper,
     IUnitOfWork unitOfWork)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
 }
示例#2
0
 public DocumentService(
     IApiMapper mapper,
     IUnitOfWork unitOfWork)
 {
     _mapper     = mapper;
     _unitOfWork = unitOfWork;
 }
 public CourseController(
     IService <CourseComment, long> service,
     IApiMapper <CourseComment, CourseCommentResponseModel> responseModelMapper,
     IApiMapper <CourseCommentRequestModel, CourseComment> requestModelMapper)
     : base(service, responseModelMapper, requestModelMapper)
 {
 }
 public ClinicianController(
     IClinicianService clinicianService,
     IApiMapper mapper)
 {
     _clinicianService = clinicianService;
     _mapper           = mapper;
 }
示例#5
0
 public static IEnumerable <TOut> Map <TIn, TOut>(this IApiMapper <TIn, TOut> mapper, IQueryable <TIn> inputQueryable)
     where TOut : class, new()
 {
     return
         (mapper is IQueryableMapper <TIn, TOut> queryableProyector?queryableProyector.Map(inputQueryable)
              : inputQueryable.AsEnumerable().Select(x => mapper.Map(x)));
 }
示例#6
0
 public TrackerManager(IApiConnector apiConnector, IApiMapper apiMapper, ITrackerParser trackerParser, ILogger <TrackerManager> logger)
 {
     this.trackerParser = trackerParser;
     this.logger        = logger;
     this.apiConnector  = apiConnector;
     this.apiMapper     = apiMapper;
 }
示例#7
0
        public static Maybe <TOut> MapAndMaybeTakeFirst <TIn, TOut>(this IApiMapper <TIn, TOut> mapper, IQueryable <TIn> query)
            where TOut : class, new()
        {
            var result = mapper.MapAndTakeFirstOrDefault(query);

            return(result == null?Maybe.None <TOut>() : Maybe.From(result));
        }
示例#8
0
 public static void Add <TIn, TOut>(this IApiMapper <TIn, TOut> mapper, IEnumerable <TIn> inputEnumerable, ICollection <TOut> outputCollection)
     where TOut : class, new()
 {
     foreach (var item in mapper.Map(inputEnumerable))
     {
         outputCollection.Add(item);
     }
 }
示例#9
0
 public static void FillPage <TIn, TOut>(this IApiMapper <TIn, TOut> mapper, PaginationParameters pagination, IQueryable <TIn> inputQueryable, int totalItems, BaseCollectionPage <TOut> output)
     where TOut : class, new()
 {
     output.items.AddRange(mapper.Map(inputQueryable));
     output.pageSize    = pagination.per_page;
     output.itemsCount  = totalItems;
     output.currentPage = pagination.page;
 }
示例#10
0
 private static void FillPage <TIn, TOut, TPageItem>(IApiMapper <TIn, TOut> mapper, PaginationParameters pagination, IEnumerable <TIn> inputItems, int totalItems, BaseCollectionPage <TPageItem> output)
     where TOut : class, TPageItem, new()
 {
     output.items.AddRange(mapper.Map(inputItems));
     output.pageSize    = pagination.per_page;
     output.itemsCount  = totalItems;
     output.currentPage = pagination.page;
 }
 protected BaseRestApiController(
     IService <TDomainModel, TIdentity> service,
     IApiMapper <TDomainModel, TResponseModel> responseModelMapper,
     IApiMapper <TRequestModel, TDomainModel> requestModelMapper)
 {
     Service             = service;
     ResponseModelMapper = responseModelMapper;
     RequestModelMapper  = requestModelMapper;
 }
示例#12
0
        public static IEnumerable <TOut> Map <TIn, TOut>(this IApiMapper <TIn, TOut> mapper, IEnumerable <TIn> inputEnumerable)
            where TOut : class, new()
        {
            var queryableProyector = mapper as IQueryableMapper <TIn, TOut>;

            return
                (queryableProyector != null?queryableProyector.Map(inputEnumerable.AsQueryable())
                     : inputEnumerable.Select(x => mapper.Map(x)));
        }
示例#13
0
        public static TCollection MapCollection <TIn, TOut, TCollection>(this IApiMapper <TIn, TOut> mapper, IEnumerable <TIn> input)
            where TOut : class, new()
            where TCollection : IModelCollection <TOut>, new()
        {
            var result = new TCollection();

            mapper.FillCollection(input, result);
            return(result);
        }
示例#14
0
 public CourseCommentController(
     ICourseCommentService courseCommentService,
     IApiMapper <CourseComment, CourseCommentResponseModel> responseModelMapper,
     IApiMapper <CourseCommentRequestModel, CourseComment> requestModelMapper)
 {
     _courseCommentService = courseCommentService;
     _responseModelMapper  = responseModelMapper;
     _requestModelMapper   = requestModelMapper;
 }
示例#15
0
 public static TPage MapPage <TIn, TOut, TPageItem, TPage>(this IApiMapper <TIn, TOut> mapper, PaginationParameters pagination, IQueryable <TIn> query)
     where TOut : class, TPageItem, new()
     where TPage : BaseCollectionPage <TPageItem>, new()
 {
     return(mapper.MapPage <TIn, TOut, TPageItem, TPage>(
                pagination,
                query.Skip(pagination.offset).Take(pagination.per_page),
                query.Count()));
 }
示例#16
0
        public static TPage MapPage <TIn, TOut, TPageItem, TPage>(this IApiMapper <TIn, TOut> mapper, PaginationParameters pagination, IQueryable <TIn> inputQueriable, int totalItems)
            where TOut : class, TPageItem, new()
            where TPage : BaseCollectionPage <TPageItem>, new()
        {
            var result = new TPage();

            FillPage(mapper, pagination, inputQueriable, totalItems, result);
            return(result);
        }
示例#17
0
        // TODO: Make this API more friendly for consumers. It should not
        // be necessary to send all type parameters:
        //
        //     var mapped = _DtoSubscriber_To_Subscriber
        //        .MapPage<DtoSubscriber, Subscriber, SubscriberCollectionPage>(pagination, result.Items, result.TotalItemsFilter);
        //
        public static TPage MapPage <TIn, TOut, TPage>(this IApiMapper <TIn, TOut> mapper, PaginationParameters pagination, IEnumerable <TIn> input, int totalItems)
            where TOut : class, new()
            where TPage : BaseCollectionPage <TOut>, new()
        {
            var result = new TPage();

            mapper.FillPage(pagination, input, totalItems, result);
            return(result);
        }
 public WatchLaterItemController(
     IWatchLaterService watchLaterItemService,
     IApiMapper <WatchLaterItem, WatchLaterItemResponseModel> responseModelMapper,
     IApiMapper <WatchLaterItemRequestModel, WatchLaterItem> requestModelMapper)
 {
     _watchLaterItemService = watchLaterItemService;
     _responseModelMapper   = responseModelMapper;
     _requestModelMapper    = requestModelMapper;
 }
示例#19
0
 public AccountService(
     ITokenService tokenService,
     IUnitOfWork unitOfWork,
     IApiMapper mapper)
 {
     _tokenService = tokenService;
     _unitOfWork   = unitOfWork;
     _mapper       = mapper;
 }
示例#20
0
 public TokenService(
     IApiMapper mapper,
     IUnitOfWork unitOfWork,
     AppSettings appSetings)
 {
     _mapper     = mapper;
     _appSetings = appSetings;
     _unitOfWork = unitOfWork;
 }
示例#21
0
 public BookingService(
     IApiMapper mapper,
     IFileService fileService,
     ITokenService tokenService,
     IUnitOfWork unitOfWork)
 {
     _mapper       = mapper;
     _fileService  = fileService;
     _tokenService = tokenService;
     _unitOfWork   = unitOfWork;
 }
示例#22
0
        public static TOut Map <TIn, TOut>(this IApiMapper <TIn, TOut> mapper, TIn input)
            where TOut : class, new()
        {
            if (input == null)
            {
                return(null);
            }

            var output = new TOut();

            mapper.Fill(input, output);
            return(output);
        }
 public FacultyController(IService <Faculty, int> service,
                          IApiMapper <Faculty, FacultyResponseModel> responseModelMapper,
                          IApiMapper <FacultyRequestModel, Faculty> requestModelMapper)
     : base(service, responseModelMapper, requestModelMapper)
 {
 }
 public LectureController(IService <Lecture, Guid> service,
                          IApiMapper <Lecture, LectureResponseModel> responseModelMapper,
                          IApiMapper <LectureRequestModel, Lecture> requestModelMapper)
     : base(service, responseModelMapper, requestModelMapper)
 {
 }
示例#25
0
 public ItemsManager(IApiConnector apiConnector, IApiMapper apiMapper, ILogger <ItemsManager> logger)
 {
     this.apiConnector = apiConnector;
     this.apiMapper    = apiMapper;
     this.logger       = logger;
 }
示例#26
0
 public TeacherController(IService <Teacher, long> service,
                          IApiMapper <Teacher, TeacherResponseModel> responseModelMapper,
                          IApiMapper <TeacherRequestModel, Teacher> requestModelMapper) : base(service, responseModelMapper, requestModelMapper)
 {
 }
示例#27
0
 public SpecialityController(IService <Speciality, int> service,
                             IApiMapper <Speciality, SpecialityResponseModel> responseModelMapper,
                             IApiMapper <SpecialityRequestModel, Speciality> requestModelMapper)
     : base(service, responseModelMapper, requestModelMapper)
 {
 }
示例#28
0
 public Commerce(IApiConnector apiConnector, IApiMapper apiMapper)
 {
     this.apiConnector = apiConnector;
     this.apiMapper    = apiMapper;
 }
示例#29
0
 public CourseLikeController(ICourseService courseService,
                             IApiMapper <Course, CourseLikeResponseModel> responseModelMapper)
 {
     _courseService       = courseService;
     _responseModelMapper = responseModelMapper;
 }
示例#30
0
 public UserController(IService <User, Guid> service, IApiMapper <User, UserResponseModel> responseModelMapper,
                       IApiMapper <UserRequestModel, User> requestModelMapper)
     : base(service, responseModelMapper, requestModelMapper)
 {
 }