Exemple #1
0
        public void UpdateCategory(Category category)
        {
            if (category == null)
            {
                throw new ArgumentNullException();
            }
            categoryDao.Update(category);

            AuditManager.Auditor.Audit(
                Category.RESOURCE_CATEGORY,
                ResourceMethod.UPDATE,
                string.Format("{0}({1})", category.Name, category.Scope));
        }
 public RequestResponse update([FromBody] Category category)
 {
     if (!ModelState.IsValid)
     {
         return(Utility.ErrorResponse(ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList()));
     }
     try
     {
         _categoryDao.Update(category);
         return(Utility.OkResponse("Kategori başarıyla güncellendi."));
     }
     catch (Exception ex)
     {
         return(Utility.ErrorResponse(ex.Message));
     }
 }
Exemple #3
0
        public override int Update(Category entity)
        {
            int count = dao.Update(entity);

            TreeNodeCollection <Category> tree = Tree(entity.Scope);
            TreeNode <Category>           node = Tree <Category> .Find(tree,
                                                                       (e) => e.Data.Id == entity.Id);

            if (node == null)
            {
                TreeNode <Category> parent = null;
                if (!string.IsNullOrWhiteSpace(entity.ParentId))
                {
                    parent = Tree <Category> .Find(tree,
                                                   (e) => e.Data.Id == entity.ParentId);
                }
                AttachToParent(tree, parent,
                               new TreeNode <Category>
                {
                    Data = entity
                });
            }
            else
            {
                TreeNode <Category> oldParent = node.Parent;
                UnattachToParent(tree, oldParent, node);
                TreeNode <Category> newParent = null;
                if (!string.IsNullOrWhiteSpace(entity.ParentId))
                {
                    newParent = Tree <Category> .Find(tree,
                                                      (e) => e.Data.Id == entity.ParentId);
                }
                node.Data = entity;
                AttachToParent(tree, newParent, node);
            }

            return(count);
        }
 public void Update(long id, CategoryParam param)
 {
     Data.Entity.Category oldEntity = Dao.Find(id);
     Data.Entity.Category newEntity = ParamConverter.Convert(param, oldEntity);
     Dao.Update(newEntity);
 }
Exemple #5
0
 public void Update(Category category)
 {
     _categoryDao.Update(category);
 }
 public bool Update(int id, Category newCategory)
 {
     return(_categoryDao.Update(id, newCategory));
 }
 public IResult Update(Category category)
 {
     _categoryDao.Update(category);
     return new SuccessResult(true, ResultMessages.CategoryUpdated);
 }