Exemplo n.º 1
0
        public static Category CategoryUpdate(Category category)
        {
            category = category.Save();

            FeedService.FeedAdd("Updated", category);

            return category;
        }
Exemplo n.º 2
0
        public static Category CategoryInsert(Category category)
        {
            category = category.Save();

            FeedService.FeedAdd("Created", category);

            return category;
        }
Exemplo n.º 3
0
        public static bool CategoryDelete(Category category)
        {
            Category.DeleteCategory(
                new CategoryCriteria
                    {
                        CategoryId = category.CategoryId
                    });

            FeedService.FeedAdd("Deleted", category);

            return true;
        }
Exemplo n.º 4
0
        public static Category CategorySave(Category category)
        {
            if (!category.IsValid)
            {
                return category;
            }

            Category result;

            if (category.IsNew)
            {
                result = CategoryService.CategoryInsert(category);
            }
            else
            {
                result = CategoryService.CategoryUpdate(category);
            }

            return result;
        }
Exemplo n.º 5
0
        public CategoryFormModel Map(Category category, CategoryFormModel model, bool ignoreBrokenRules)
        {
            Csla.Data.DataMapper.Map(category, model, true);

            model.Tab = "Home";
            model.IsNew = category.IsNew;
            model.IsValid = category.IsValid;

            if (!ignoreBrokenRules)
            {
                foreach (var brokenRule in category.BrokenRulesCollection)
                {
                    this.ModelState.AddModelError(string.Empty, brokenRule.Description);
                }
            }

            return model;
        }