Beispiel #1
0
 /// <summary>
 /// Преобразовать категории одежды из трансферной модели
 /// </summary>
 public override IResultValue <IHostConfigurationDomain> FromTransfer(HostConfigurationTransfer hostConfigurationTransfer) =>
 GetHostConfigurationFunc(hostConfigurationTransfer).
 ResultValueCurryOk(hostConfigurationTransfer.Host.
                    ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(hostConfigurationTransfer.Host)))).
 ResultValueCurryOk(hostConfigurationTransfer.TimeOut.
                    ToResultValueWhere(timeOut => timeOut.TotalSeconds > 0,
                                       _ => new ErrorResult(ErrorResultType.ValueNotValid,
                                                            $"Значение {nameof(hostConfigurationTransfer.TimeOut)} должно быть больше 0"))).
 ResultValueOk(func => func.Invoke());
Beispiel #2
0
 /// <summary>
 /// Преобразовать в доменные модели
 /// </summary>
 public IResultCollection <TDomain> GetDomains(IEnumerable <TTransfer>?transfers) =>
 transfers.
 ToResultCollectionNullCheck(ConverterErrors.ValueNotFoundError(typeof(IEnumerable <TTransfer>).Name)).
 ResultCollectionBindOk(FromTransfers);
Beispiel #3
0
 /// <summary>
 /// Преобразовать в доменную модель
 /// </summary>
 public IResultValue <TDomain> GetDomain(TTransfer?transfer) =>
 transfer.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(typeof(TTransfer).Name)).
 ResultValueBindOk(FromTransfer);
 /// <summary>
 /// Получить сущности размера одежды
 /// </summary>
 private static IResultCollection <SizeEntity> GetSizes(IEnumerable <SizeGroupCompositeEntity> sizeGroupCompositeEntities) =>
 sizeGroupCompositeEntities.
 Select(composite => composite.Size.
        ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(composite.Size)))).
 ToResultCollection();
 /// <summary>
 /// Преобразовать связующую сущность в коллекцию размеров
 /// </summary>
 private IResultCollection <ISizeDomain> SizeDomainsFromComposite(IEnumerable <SizeGroupCompositeEntity>?sizeGroupCompositeEntities) =>
 sizeGroupCompositeEntities.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(sizeGroupCompositeEntities))).
 ResultValueBindOkToCollection(GetSizes).
 ResultCollectionBindOk(sizeEntities => _sizeEntityConverter.FromEntities(sizeEntities));
Beispiel #6
0
 /// <summary>
 /// Получить сущности категории одежды
 /// </summary>
 private static IResultCollection <CategoryEntity> GetCategories(IEnumerable <GenderCategoryCompositeEntity> genderCategoryCompositeEntities) =>
 genderCategoryCompositeEntities.
 Select(composite => composite.Category.
        ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(composite.Gender)))).
 ToResultCollection();
Beispiel #7
0
 /// <summary>
 /// Преобразовать связующую сущность в категорию одежды
 /// </summary>
 private IResultCollection <ICategoryClothesTypeDomain> CategoryDomainsFromComposite(IEnumerable <GenderCategoryCompositeEntity>?genderCategoryCompositeEntity) =>
 genderCategoryCompositeEntity.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(genderCategoryCompositeEntity))).
 ResultValueBindOkToCollection(GetCategories).
 ResultCollectionBindOk(categoryEntities => _categoryClothesTypeEntityConverter.FromEntities(categoryEntities));
 /// <summary>
 /// Преобразовать связующую сущность в тип пола
 /// </summary>
 private IResultCollection <IGenderDomain> GenderDomainsFromComposite(IEnumerable <GenderCategoryCompositeEntity>?genderCategoryCompositeEntity) =>
 genderCategoryCompositeEntity.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(genderCategoryCompositeEntity))).
 ResultValueBindOkToCollection(GetGenders).
 ResultCollectionBindOk(genderEntities => _genderEntityConverter.FromEntities(genderEntities));
 /// <summary>
 /// Преобразовать пол одежды в доменную модель
 /// </summary>
 private IResultValue <ICategoryDomain> GetCategory(CategoryEntity?categoryEntity) =>
 categoryEntity.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(categoryEntity))).
 ResultValueBindOk(category => _categoryEntityConverter.FromEntity(category));
Beispiel #10
0
 /// <summary>
 /// Получить сущности группы размеров
 /// </summary>
 private static IResultCollection <SizeGroupEntity> GetColorClothes(IEnumerable <ClothesSizeGroupCompositeEntity> clothesSizeGroupEntities) =>
 clothesSizeGroupEntities.
 Select(sizeGroup => sizeGroup.SizeGroup.
        ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(sizeGroup.SizeGroup)))).
 ToResultCollection();
Beispiel #11
0
 /// <summary>
 /// Получить сущности цвета одежды
 /// </summary>
 private static IResultCollection <ColorEntity> GetColorClothes(IEnumerable <ClothesColorCompositeEntity> clothesColorEntities) =>
 clothesColorEntities.
 Select(clothesColor => clothesColor.ColorClothes.
        ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(clothesColor.ColorClothes)))).
 ToResultCollection();
Beispiel #12
0
 /// <summary>
 /// Получить изображения
 /// </summary>
 private IResultCollection <IClothesImageDomain> GetImages(IEnumerable <ClothesImageEntity>?imageEntities) =>
 imageEntities.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(imageEntities))).
 ToResultCollection().
 ResultCollectionBindOk(images => _clothesImageEntityConverter.FromEntities(images));
Beispiel #13
0
 /// <summary>
 /// Преобразовать тип одежды в доменную модель
 /// </summary>
 private IResultValue <IClothesTypeDomain> GetClothesType(ClothesTypeEntity?clothesTypeEntity) =>
 clothesTypeEntity.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(clothesTypeEntity))).
 ResultValueBindOk(clothesType => _clothesTypeEntityConverter.FromEntity(clothesType));
Beispiel #14
0
 /// <summary>
 /// Преобразовать пол одежды в доменную модель
 /// </summary>
 private IResultValue <IGenderDomain> GetGender(GenderEntity?genderEntity) =>
 genderEntity.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(genderEntity))).
 ResultValueBindOk(gender => _genderEntityConverter.FromEntity(gender));
Beispiel #15
0
 /// <summary>
 /// Преобразовать связующую сущность в коллекцию размеров
 /// </summary>
 public static IResultCollection <ISizeGroupMainDomain> SizeGroupFromComposite(IEnumerable <ClothesSizeGroupCompositeEntity>?clothesSizeCompositeEntities,
                                                                               ISizeGroupMainEntityConverter sizeGroupMainEntityConverter) =>
 clothesSizeCompositeEntities.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(clothesSizeCompositeEntities))).
 ResultValueBindOkToCollection(GetColorClothes).
 ResultCollectionBindOk(sizeGroupMainEntityConverter.FromEntities);
Beispiel #16
0
 /// <summary>
 /// Преобразовать связующую сущность в коллекцию цветов
 /// </summary>
 public static IResultCollection <IColorDomain> ColorClothesFromComposite(IEnumerable <ClothesColorCompositeEntity>?clothesColorCompositeEntities,
                                                                          IColorClothesEntityConverter colorClothesEntityConverter) =>
 clothesColorCompositeEntities.
 ToResultValueNullCheck(ConverterErrors.ValueNotFoundError(nameof(clothesColorCompositeEntities))).
 ResultValueBindOkToCollection(GetColorClothes).
 ResultCollectionBindOk(colorClothesEntityConverter.FromEntities);