Пример #1
0
        public async Task <IEnumerable <StockCodeRate> > GetLatestCoinData()
        {
            var coinMarketData = await _contextService.GetCoins();

            var coinDto = CoinMapper.ConvertToDto(coinMarketData);

            return(coinDto);
        }
Пример #2
0
        public async Task <ServiceResult> InsertAllStocks()
        {
            var currencyList = await GetLatestCurrency();

            var bistList = await GetLatestBist();

            var coinDtoList = await GetLatestCoinData();

            var date   = DateTime.UtcNow.Date; // bistList.FirstOrDefault().Date;
            var entity = new StockData
            {
                Date       = date,
                BistStocks = BistStockMapper.ConvertToBistStock(bistList),
                Currency   = CurrencyMapper.ConvertToCurrency(currencyList),
                Coins      = CoinMapper.ConvertToDailyCoin(coinDtoList)
            };
            var result = await _stockRepo.Create(entity);

            if (result != null)
            {
                return(new ServiceResult(ServiceStatus.Created));
            }
            return(new ServiceResult(ServiceStatus.NotCreated));
        }
Пример #3
0
        public static void CreateMappings(IMapperConfigurationExpression configuration)
        {
            //Inputs
            configuration.CreateMap <CheckboxInputType, FeatureInputTypeDto>();
            configuration.CreateMap <SingleLineStringInputType, FeatureInputTypeDto>();
            configuration.CreateMap <ComboboxInputType, FeatureInputTypeDto>();
            configuration.CreateMap <IInputType, FeatureInputTypeDto>()
            .Include <CheckboxInputType, FeatureInputTypeDto>()
            .Include <SingleLineStringInputType, FeatureInputTypeDto>()
            .Include <ComboboxInputType, FeatureInputTypeDto>();
            configuration.CreateMap <StaticLocalizableComboboxItemSource, LocalizableComboboxItemSourceDto>();
            configuration.CreateMap <ILocalizableComboboxItemSource, LocalizableComboboxItemSourceDto>()
            .Include <StaticLocalizableComboboxItemSource, LocalizableComboboxItemSourceDto>();
            configuration.CreateMap <LocalizableComboboxItem, LocalizableComboboxItemDto>();
            configuration.CreateMap <ILocalizableComboboxItem, LocalizableComboboxItemDto>()
            .Include <LocalizableComboboxItem, LocalizableComboboxItemDto>();

            //Chat
            configuration.CreateMap <ChatMessage, ChatMessageDto>();
            configuration.CreateMap <ChatMessage, ChatMessageExportDto>();

            //Feature
            configuration.CreateMap <FlatFeatureSelectDto, Feature>().ReverseMap();
            configuration.CreateMap <Feature, FlatFeatureDto>();

            //Role
            configuration.CreateMap <RoleEditDto, Role>().ReverseMap();
            configuration.CreateMap <Role, RoleListDto>();
            configuration.CreateMap <UserRole, UserListRoleDto>();

            //Edition
            configuration.CreateMap <EditionEditDto, SubscribableEdition>().ReverseMap();
            configuration.CreateMap <EditionCreateDto, SubscribableEdition>();
            configuration.CreateMap <EditionSelectDto, SubscribableEdition>().ReverseMap();
            configuration.CreateMap <SubscribableEdition, EditionInfoDto>();

            configuration.CreateMap <Edition, EditionInfoDto>().Include <SubscribableEdition, EditionInfoDto>();

            configuration.CreateMap <SubscribableEdition, EditionListDto>();
            configuration.CreateMap <Edition, EditionEditDto>();
            configuration.CreateMap <Edition, SubscribableEdition>();
            configuration.CreateMap <Edition, EditionSelectDto>();


            //Payment
            configuration.CreateMap <SubscriptionPaymentDto, SubscriptionPayment>().ReverseMap();
            configuration.CreateMap <SubscriptionPaymentListDto, SubscriptionPayment>().ReverseMap();
            configuration.CreateMap <SubscriptionPayment, SubscriptionPaymentInfoDto>();

            //Permission
            configuration.CreateMap <Permission, FlatPermissionDto>();
            configuration.CreateMap <Permission, FlatPermissionWithLevelDto>();

            //Language
            configuration.CreateMap <ApplicationLanguage, ApplicationLanguageEditDto>();
            configuration.CreateMap <ApplicationLanguage, ApplicationLanguageListDto>();
            configuration.CreateMap <NotificationDefinition, NotificationSubscriptionWithDisplayNameDto>();
            configuration.CreateMap <ApplicationLanguage, ApplicationLanguageEditDto>()
            .ForMember(ldto => ldto.IsEnabled, options => options.MapFrom(l => !l.IsDisabled));

            //Tenant
            configuration.CreateMap <Tenant, RecentTenant>();
            configuration.CreateMap <Tenant, TenantLoginInfoDto>();
            configuration.CreateMap <Tenant, TenantListDto>();
            configuration.CreateMap <TenantEditDto, Tenant>().ReverseMap();
            configuration.CreateMap <CurrentTenantInfoDto, Tenant>().ReverseMap();

            //User
            configuration.CreateMap <User, UserEditDto>()
            .ForMember(dto => dto.Password, options => options.Ignore())
            .ReverseMap()
            .ForMember(user => user.Password, options => options.Ignore());
            configuration.CreateMap <User, UserLoginInfoDto>();
            configuration.CreateMap <User, UserListDto>();
            configuration.CreateMap <User, ChatUserDto>();
            configuration.CreateMap <User, OrganizationUnitUserListDto>();
            configuration.CreateMap <Role, OrganizationUnitRoleListDto>();
            configuration.CreateMap <CurrentUserProfileEditDto, User>().ReverseMap();
            configuration.CreateMap <UserLoginAttemptDto, UserLoginAttempt>().ReverseMap();
            configuration.CreateMap <ImportUserDto, User>();

            //AuditLog
            configuration.CreateMap <AuditLog, AuditLogListDto>();
            configuration.CreateMap <EntityChange, EntityChangeListDto>();
            configuration.CreateMap <EntityPropertyChange, EntityPropertyChangeDto>();

            //Friendship
            configuration.CreateMap <Friendship, FriendDto>();
            configuration.CreateMap <FriendCacheItem, FriendDto>();

            //OrganizationUnit
            configuration.CreateMap <OrganizationUnit, OrganizationUnitDto>();

            //Webhooks
            configuration.CreateMap <WebhookSubscription, GetAllSubscriptionsOutput>();
            configuration.CreateMap <WebhookSendAttempt, GetAllSendAttemptsOutput>()
            .ForMember(webhookSendAttemptListDto => webhookSendAttemptListDto.WebhookName,
                       options => options.MapFrom(l => l.WebhookEvent.WebhookName))
            .ForMember(webhookSendAttemptListDto => webhookSendAttemptListDto.Data,
                       options => options.MapFrom(l => l.WebhookEvent.Data));

            configuration.CreateMap <WebhookSendAttempt, GetAllSendAttemptsOfWebhookEventOutput>();

            configuration.CreateMap <DynamicParameter, DynamicParameterDto>().ReverseMap();
            configuration.CreateMap <DynamicParameterValue, DynamicParameterValueDto>().ReverseMap();
            configuration.CreateMap <EntityDynamicParameter, EntityDynamicParameterDto>()
            .ForMember(dto => dto.DynamicParameterName,
                       options => options.MapFrom(entity => entity.DynamicParameter.ParameterName));
            configuration.CreateMap <EntityDynamicParameterDto, EntityDynamicParameter>();

            configuration.CreateMap <EntityDynamicParameterValue, EntityDynamicParameterValueDto>().ReverseMap();
            //User Delegations
            configuration.CreateMap <CreateUserDelegationDto, UserDelegation>();


            /* ADD YOUR OWN CUSTOM AUTOMAPPER MAPPINGS HERE */

            #region Trade
            IntervalMapper.CreateMap(configuration);
            CoinMapper.CreateMap(configuration);
            #endregion
        }