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()); }
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()); }