Beispiel #1
0
        public void AddGoodsCategory(GoodsCategoryDTO goodsCategoryDTO, string operatorId)
        {
            var obj = new Domains.Aggregates.GoodsCategory
            {
                Name     = goodsCategoryDTO.Name,
                ParentId = goodsCategoryDTO.ParentId,
                Icon     = goodsCategoryDTO.Icon
            };

            obj.GenerateId();
            _goodsCategoryRepository.Add(obj);

            if (goodsCategoryDTO.Tags != null && goodsCategoryDTO.Tags.Count() > 0)
            {
                foreach (var item in goodsCategoryDTO.Tags)
                {
                    var o = new Domains.Aggregates.Tag {
                        CategoryId = obj.Id, CreatedBy = operatorId, CreatedOn = DateTime.Now, Name = item.Name
                    };
                    o.GenerateId();
                    _tagRepository.Add(o);
                }
            }

            _dbUnitOfWork.Commit();
        }
Beispiel #2
0
        public void AddServiceCategory(CategoryDTO categoryDTO, string operatorId)
        {
            var obj = new Domains.Aggregates.Category
            {
                Name          = categoryDTO.Name,
                ParentId      = categoryDTO.ParentId,
                Mark          = categoryDTO.Mark,
                ApplicationId = categoryDTO.AppId
            };

            obj.GenerateId();
            _serviceCategoryRepository.Add(obj);

            if (categoryDTO.Tags != null && categoryDTO.Tags.Count() > 0)
            {
                foreach (var item in categoryDTO.Tags)
                {
                    var o = new Domains.Aggregates.Tag {
                        CategoryId = obj.Id, CreatedBy = operatorId, CreatedOn = DateTime.Now, Name = item.Name
                    };
                    o.GenerateId();
                    _tagRepository.Add(o);
                }
            }

            _dbUnitOfWork.Commit();
        }