public override int Delete(Category entity) { int count = dao.Delete(entity); TreeNodeCollection <Category> tree = Tree(entity.Scope); Tree <Category> .PostorderTraverse(tree, (e) => { if (entity.Id == e.Data.Id) { UnattachToParent(tree, e.Parent, e); if (!e.IsLeaf) { Tree <Category> .PostorderTraverse(e, (subNode) => { if (subNode.Parent != null) { subNode.Parent.Children.Remove(subNode); } }); } } }); return(count); }
//public void DeleteCategory(int scope, IEnumerable<string> idCol) //{ // if (idCol == null || idCol.Count() == 0) // { // throw new ArgumentNullException(); // } // var categories = ListCategory(scope); // if (categories != null && categories.Count() > 0) // { // var deleteList = categories.Where(e => idCol.Contains(e.Id)); // if (deleteList != null && deleteList.Count() > 0) // { // categoryDao.Delete(deleteList.ToArray()); // } // } //} //public Task DeleteCategoryAsync(int scope, IEnumerable<string> idCol) //{ // return Task.Factory.StartNew( // () => // { // DeleteCategory(scope, idCol); // }); //} public void DeleteCategory(Category category) { if (category == null) { throw new ArgumentNullException(); } categoryDao.Delete(category); AuditManager.Auditor.Audit( Category.RESOURCE_CATEGORY, ResourceMethod.DELETE, string.Format("{0}({1})", category.Name, category.Scope)); }
public RequestResponse Delete(string id) { try { _categoryDao.Delete(id); return(Utility.OkResponse("Kategori başarıyla silindi.")); } catch (Exception ex) { return(Utility.ErrorResponse(ex.Message)); } }
public void Delete(long id) { Dao.Delete(id); }
public void Delete(Category category) { _categoryDao.Delete(category); }
public IResult Delete(Category category) { _categoryDao.Delete(category); return new SuccessResult(true, ResultMessages.CategoryDeleted); }