コード例 #1
0
        public OpResult RemoveRole(int[] ids)
        {
            var list = ProductRoleRepository.GetQuery(o => ids.Contains(o.Id)).Include(o => o.ProductRoleDatas).ToList();

            ProductRoleDataRepository.RemoveRange(list.SelectMany(o => o.ProductRoleDatas).ToList(), false);
            ProductRoleRepository.RemoveRange(list);
            return(OpResult.Success());
        }
コード例 #2
0
        public OpResult Deletes(int[] ids)
        {
            var list = ProductRoleVerRepository.GetQuery(o => ids.Contains(o.Id)).Include(o => o.ProductRoles).Include("ProductRoles.ProductRoleDatas").ToList();

            if (list.Any(o => o.VerStatus > 0))
            {
                return(OpResult.Fail("该状态不允许删除!"));
            }
            ProductRoleDataRepository.RemoveRange(list.SelectMany(o => o.ProductRoles.SelectMany(i => i.ProductRoleDatas)).ToList(), false);
            ProductRoleRepository.RemoveRange(list.SelectMany(o => o.ProductRoles).ToList(), false);
            ProductRoleVerRepository.RemoveRange(list);
            return(OpResult.Success());
        }