Ejemplo n.º 1
0
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <param name="catalog"></param>
        /// <returns></returns>
        public static dataModel.CategoryRelation ToDataModel(this coreModel.CategoryLink categoryLink, coreModel.Category category)
        {
            var retVal = new dataModel.CategoryRelation
            {
                SourceCategoryId = category.Id,
                TargetCategoryId = categoryLink.CategoryId,
                TargetCatalogId  = categoryLink.CatalogId
            };

            return(retVal);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <param name="catalog"></param>
        /// <returns></returns>
        public static coreModel.CategoryLink ToCoreModel(this dataModel.CategoryRelation linkedCategory, coreModel.Category category)
        {
            if (linkedCategory == null)
            {
                throw new ArgumentNullException("linkedCategory");
            }

            var retVal = new coreModel.CategoryLink();

            retVal.CategoryId = linkedCategory.TargetCategoryId;
            retVal.CatalogId  = linkedCategory.TargetCatalogId;

            return(retVal);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <param name="catalog"></param>
        /// <returns></returns>
        public static coreModel.CategoryLink ToCoreModel(this dataModel.CategoryRelation linkedCategory, dataModel.Catalog[] allCatalogs, dataModel.Category[] allCategories)
        {
            if (linkedCategory == null)
            {
                throw new ArgumentNullException("linkedCategory");
            }

            var retVal = new coreModel.CategoryLink();

            retVal.CategoryId = linkedCategory.TargetCategoryId;
            retVal.CatalogId  = linkedCategory.TargetCatalogId;
            retVal.Catalog    = allCatalogs.First(x => x.Id == linkedCategory.TargetCatalogId).ToCoreModel(false);
            if (linkedCategory.TargetCategoryId != null)
            {
                retVal.Category = allCategories.First(x => x.Id == linkedCategory.TargetCategoryId)
                                  .ToCoreModel(allCatalogs, allCategories, convertProps: false);
            }
            return(retVal);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Patch LinkedCategory type
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public static void Patch(this dataModel.CategoryRelation source, dataModel.CategoryRelation target)
 {
     //Nothing todo. Because we not support change  link
 }