Beispiel #1
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);
            }
        }