Exemplo n.º 1
0
        ///TODO- need to add this profile fields in db and api
        public IActionResult GetCertificateQuestionByID(int id)
        {
            var qa = _questionService.GetById(id);

            QuestionDto question = new QuestionDto()
            {
                ID            = qa.ID,
                QuestionTitle = qa.QuestionTitle,
                CreatedBy     = qa.CreatedBy,
                CreatedOn     = qa.CreatedOn,
                ModifiedBy    = qa.ModifiedBy,
                ModifiedOn    = qa.ModifiedOn
            };

            question.Certificates = new List <CertificateDto>();
            foreach (CertificateQuestion c in qa.CertificateQuestions)
            {
                Certificate    certificate    = c.Certificate;
                CertificateDto certificateDto = new CertificateDto();
                if (certificate == null)
                {
                    certificate    = _certificateService.GetById(c.CertificateID);
                    certificateDto = new CertificateDto()
                    {
                        ID              = certificate.ID,
                        Name            = certificate.Name,
                        ParentID        = certificate.ParentID,
                        CreatedBy       = certificate.CreatedBy,
                        CreatedOn       = certificate.CreatedOn,
                        ModifiedBy      = certificate.ModifiedBy,
                        ModifiedOn      = certificate.ModifiedOn,
                        Status          = certificate.Status,
                        IsCertificateQA = certificate.IsCertificateQA
                    };
                }

                question.Certificates.Add(certificateDto);
            }
            return(Ok(question));
        }
Exemplo n.º 2
0
        ///TODO- need to add this profile fields in db and api
        public IActionResult GetCertificateByID(int id)
        {
            var certificate = _service.GetById(id);

            if (certificate == null)
            {
                return(new UnauthorizedResult());
            }
            CertificateDto certificateDto = new CertificateDto()
            {
                ID              = certificate.ID,
                Name            = certificate.Name,
                ParentID        = certificate.ParentID,
                CreatedBy       = certificate.CreatedBy,
                CreatedOn       = certificate.CreatedOn,
                ModifiedBy      = certificate.ModifiedBy,
                ModifiedOn      = certificate.ModifiedOn,
                Status          = certificate.Status,
                IsCertificateQA = certificate.IsCertificateQA
            };

            return(Ok(certificateDto));
        }