Пример #1
0
 public static List <ValidateResult> Validate(RoleAssets ra)
 {
     return
         (ra.NotGuidEmpty(ra.AssetId, "")
          .NotGuidEmpty(ra.RoleId, "")
          .Validate());
 }
Пример #2
0
        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);
        }