Beispiel #1
0
        public int CreateCategory(Category category)
        {
            var dataRec = Mapper.Map <Data.Models.Category>(category);
            int id      = _categoryGateway.Insert(dataRec);

            //RemoveObjectFromCache("Categories");
            category.CategoryId = id;
            _searchService.UpdateIndex(category);
            return(id);
        }
Beispiel #2
0
        public int CreateCategory(Category category)
        {
            category.Type = category.GetType().FullName;

            var dataCategory = Mapper.Map <Data.Models.Category>(category);

            using (var ts = new TransactionScope())
            {
                int id = category.HeartId = dataCategory.HeartId = _heartService.CreateHeart(category);
                _categoryGateway.Insert(dataCategory);
                RemoveObjectFromCache("Categories");
                RemoveObjectFromCache("AllCategories");
                RemoveObjectFromCache($"ChildCategoriesFor{category.ParentCategoryId}");
                ts.Complete();
                return(id);
            }
        }