コード例 #1
0
ファイル: MxIdentitySeedDb.cs プロジェクト: wpqs/MxAutoGDPR
        private async Task <MxReturnCode <Guid> > SeedStdTermsConditions(GdprSeedRepo gdprSeedRepo)
        {
            MxReturnCode <Guid> rc = new MxReturnCode <Guid>("MxIdentityDb.CreateStdTermsConditions()");

            if (gdprSeedRepo == null)
            {
                rc.SetError(3060301, MxError.Source.Param, "gdprSeedRepo is null");
            }
            else
            {
                var resGetExisting = await gdprSeedRepo.GetWstAsync(_config["WST:Standard"]);

                rc += resGetExisting;
                if (rc.IsSuccess())
                {
                    if (resGetExisting.GetResult() != null)
                    {
                        rc.SetResult(resGetExisting.GetResult().Id);
                    }
                    else
                    {
                        var resCreate = await gdprSeedRepo.CreateWstAsync(_config["WST:Standard"], "descr", "url");

                        rc += resCreate;
                        if (rc.IsSuccess())
                        {
                            var resGetNew = await gdprSeedRepo.GetWstAsync(_config["WST:Standard"]);

                            rc += resGetNew;
                            if (rc.IsSuccess())
                            {
                                if (resGetExisting.GetResult() == null)
                                {
                                    rc.SetError(3060302, MxError.Source.Data, @"wst cannot be created",
                                                MxMsgs.MxErrUnexpected);
                                }
                                else
                                {
                                    var wst = resGetExisting.GetResult().Id;
                                    if (wst == Guid.Empty)
                                    {
                                        rc.SetError(3060303, MxError.Source.Sys,
                                                    @"wst Default not found and cannot be created", MxMsgs.MxErrUnexpected);
                                    }
                                    else
                                    {
                                        rc.SetResult(wst);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(rc);
        }
コード例 #2
0
ファイル: MxIdentitySeedDb.cs プロジェクト: wpqs/MxAutoGDPR
        private async Task <MxReturnCode <bool> > DeseedStdTermsConditions(GdprSeedRepo gdprSeedRepo)
        {
            MxReturnCode <bool> rc = new MxReturnCode <bool>($"MxIdentityDb.DeseedStdTermsCondition");

            if (gdprSeedRepo == null)
            {
                rc.SetError(3060301, MxError.Source.Param, "gdprSeedRepo is null");
            }
            else
            {
                var resGetExisting = await gdprSeedRepo.GetWstAsync(_config["WST:Standard"]);

                rc += resGetExisting;
                if (rc.IsSuccess())
                {
                    if (resGetExisting.GetResult() == null)
                    {
                        rc.SetResult(true);
                    }
                    else
                    {
                        //delete resGetExisting.GetResult()
                        rc.SetResult(true);
                    }
                }
            }
            return(rc);
        }