Exemplo n.º 1
0
        public ActionResult <IEnumerable <CertificateInfo> > AddTrustedCertificate([FromServices] ISafeguardLogic safeguard, [FromBody] CertificateInfo certificate, [FromQuery] bool importFromSafeguard)
        {
            IEnumerable <CertificateInfo> trustedCertificates;

            if (importFromSafeguard)
            {
                trustedCertificates = safeguard.ImportTrustedCertificates();
            }
            else
            {
                var trustedCertificate = safeguard.AddTrustedCertificate(certificate);
                trustedCertificates = new List <CertificateInfo>()
                {
                    trustedCertificate
                };
            }

            return(Ok(trustedCertificates));
        }