예제 #1
0
        /// <summary>
        /// Converting to foundation type
        /// </summary>
        /// <param name="catalog"></param>
        /// <returns></returns>
        public static dataModel.CategoryItemRelation ToDataModel(this coreModel.CategoryLink categoryLink, coreModel.CatalogProduct product)
        {
            var retVal = new dataModel.CategoryItemRelation
            {
                CategoryId = categoryLink.CategoryId,
                ItemId     = product.Id,
                CatalogId  = categoryLink.CatalogId,
                Priority   = 100
            };

            return(retVal);
        }
예제 #2
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.CategoryLink ToCoreModel(this dataModel.CategoryItemRelation categoryItemRelation)
        {
            if (categoryItemRelation == null)
            {
                throw new ArgumentNullException("categoryItemRelation");
            }

            var retVal = new coreModel.CategoryLink
            {
                CategoryId = categoryItemRelation.CategoryId,
                CatalogId  = categoryItemRelation.CatalogId
            };

            return(retVal);
        }
예제 #3
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.CategoryLink ToCoreModel(this dataModel.CategoryItemRelation categoryItemRelation, dataModel.Catalog[] allCatalogs, dataModel.Category[] allCategories)
        {
            if (categoryItemRelation == null)
            {
                throw new ArgumentNullException("categoryItemRelation");
            }

            var retVal = new coreModel.CategoryLink
            {
                CategoryId = categoryItemRelation.CategoryId,
                CatalogId  = categoryItemRelation.CatalogId,
                Priority   = categoryItemRelation.Priority
            };

            retVal.Catalog = allCatalogs.First(x => x.Id == categoryItemRelation.CatalogId).ToCoreModel(false);
            if (categoryItemRelation.CategoryId != null)
            {
                retVal.Category = allCategories.First(x => x.Id == categoryItemRelation.CategoryId)
                                  .ToCoreModel(allCatalogs, allCategories, convertProps: false);
            }

            return(retVal);
        }
예제 #4
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.CategoryLink ToCoreModel(this dataModel.CategoryItemRelation categoryItemRelation)
        {
            if (categoryItemRelation == null)
            {
                throw new ArgumentNullException("categoryItemRelation");
            }

            var retVal = new coreModel.CategoryLink
            {
                CategoryId = categoryItemRelation.CategoryId,
                CatalogId  = categoryItemRelation.CatalogId,
                Priority   = categoryItemRelation.Priority
            };

            if (categoryItemRelation.Category != null)
            {
                retVal.Category = categoryItemRelation.Category.ToCoreModel(false);
            }
            if (categoryItemRelation.Catalog != null)
            {
                retVal.Catalog = categoryItemRelation.Catalog.ToCoreModel(false);
            }
            return(retVal);
        }
예제 #5
0
 /// <summary>
 /// Patch LinkedCategory type
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public static void Patch(this dataModel.CategoryItemRelation source, dataModel.CategoryItemRelation target)
 {
     //Nothing todo. Because we not support change link
 }