Example #1
0
        public async Task <IActionResult> Add([FromBody] AssetExtendedInfo assetInfo)
        {
            assetInfo = Mapper.Map <AssetExtendedInfo>(await _assetExtendedInfoService.AddAsync(assetInfo));

            return(Created
                   (
                       uri:   $"api/v2/asset-extended-infos/{assetInfo.Id}",
                       value: assetInfo
                   ));
        }
        public static AssetExtendedInfoNoSql Create(IAssetExtendedInfo source)
        {
            var item = new AssetExtendedInfoNoSql()
            {
                PartitionKey = GeneratePartitionKey(),
                RowKey       = GenerateRowKey(source.Id),
                ExtendedInfo = AssetExtendedInfo.Create(source)
            };

            return(item);
        }
 public static AssetDescriptionModel ToApiModel(this AssetExtendedInfo extendedInfo)
 {
     return(new AssetDescriptionModel
     {
         Id = extendedInfo.Id,
         AssetClass = extendedInfo.AssetClass,
         Description = extendedInfo.Description,
         IssuerName = null,
         NumberOfCoins = extendedInfo.NumberOfCoins,
         AssetDescriptionUrl = extendedInfo.AssetDescriptionUrl,
         FullName = extendedInfo.FullName
     });
 }
Example #4
0
 private static AssetDescriptionModel ConvertToAssetDescription(AssetExtendedInfo extendedInfo)
 {
     return(new AssetDescriptionModel
     {
         Id = extendedInfo.Id,
         AssetClass = extendedInfo.AssetClass,
         Description = extendedInfo.Description,
         IssuerName = null,
         MarketCapitalization = extendedInfo.MarketCapitalization,
         NumberOfCoins = extendedInfo.NumberOfCoins,
         PopIndex = extendedInfo.PopIndex,
         AssetDescriptionUrl = extendedInfo.AssetDescriptionUrl,
         FullName = extendedInfo.FullName
     });
 }
            public static AssetExtendedInfo Create(IAssetExtendedInfo source)
            {
                var item = new AssetExtendedInfo()
                {
                    Id                   = source.Id,
                    AssetClass           = source.AssetClass,
                    AssetDescriptionUrl  = source.AssetDescriptionUrl,
                    Description          = source.Description,
                    FullName             = source.FullName,
                    MarketCapitalization = source.MarketCapitalization,
                    NumberOfCoins        = source.NumberOfCoins,
                    PopIndex             = source.PopIndex
                };

                return(item);
            }
        public static AssetExtended ConvertTpApiModel(this AssetExtendedInfo src)
        {
            var asset = new ApiAssetModel {
                Id = src.Id, Name = src.FullName
            };
            var description = new AssetDescriptionModel
            {
                Id          = src.Id,
                Description = src.Description,
                AssetClass  = src.AssetClass,
                FullName    = src.FullName
            };
            var category   = new ApiAssetCategoryModel();
            var attributes = new List <IAssetAttributesKeyValue>();

            return(new AssetExtended
            {
                Asset = asset,
                Description = description,
                Category = category,
                Attributes = attributes
            });
        }
Example #7
0
        public async Task <IActionResult> Update([FromBody] AssetExtendedInfo assetInfo)
        {
            await _assetExtendedInfoService.UpdateAsync(assetInfo);

            return(NoContent());
        }
 public static void AreEquivalent(this Assert assert, IAssetExtendedInfo expected, AssetExtendedInfo actual)
 {
     if (expected.AssetClass != actual.AssetClass ||
         expected.AssetDescriptionUrl != actual.AssetDescriptionUrl ||
         expected.Description != actual.Description ||
         expected.FullName != actual.FullName ||
         expected.Id != actual.Id ||
         expected.MarketCapitalization != actual.MarketCapitalization ||
         expected.NumberOfCoins != actual.NumberOfCoins ||
         expected.PopIndex != actual.PopIndex)
     {
         throw new AssertFailedException("Asset extended infos do not match.");
     }
 }