示例#1
0
        private void CreateCertificate(int testId, int score)
        {
            var user = _userService.GetUserByEmail(User.Identity.Name);
            var lastCertificateNumber = _certificateService.GetLastCertificateNumber();
            var numbers = Convert.ToInt32(lastCertificateNumber.Substring(2));

            numbers++;
            var certificate = new CertificateDTO
            {
                Score             = score,
                CertificateNumber = "CN" + numbers,
                TestDate          = DateTime.Now,
                TestId            = testId,
                UserId            = user.UserID
            };

            _certificateService.CreateCertificate(certificate);
        }