public static List <ValidateResult> Validate(RoleAssets ra) { return (ra.NotGuidEmpty(ra.AssetId, "") .NotGuidEmpty(ra.RoleId, "") .Validate()); }
public async Task <bool> BindResource(RoleAssets roleAccess) { var validteReuslt = RoleAssets.Validate(roleAccess); if (validteReuslt.All(x => x.IsSuccess) && RoleAssetsDb.GetSingle(ra => ra.RoleId == roleAccess.RoleId && ra.AssetId == roleAccess.AssetId).IsNull() ) { var effectCount = await RoleAssetsDb.AsInsertable(roleAccess).ExecuteCommandAsync(); return(effectCount > 0); } return(false); }