Ejemplo n.º 1
0
        public ActionResult IssueCertificate(IssueDetails registrationData)
        {
            var    img       = registrationData.ImageFile.FileName;
            string Filename  = Path.GetFileNameWithoutExtension(img);
            string extension = Path.GetExtension(registrationData.ImageFile.FileName);

            Filename = Filename + DateTime.Now.ToString("yymmssfff") + extension;
            registrationData.Certificate = "~/Certificate/" + Filename;
            Filename = Path.Combine(Server.MapPath("~/Certificate/"), Filename);
            registrationData.ImageFile.SaveAs(Filename);
            if (registrationData != null)
            {
                tblCertificate certificate = new tblCertificate();
                certificate.StudentId     = registrationData.StudentId;
                certificate.CertificateNo = registrationData.CertificateNo;
                certificate.Certificate   = registrationData.Certificate;

                db.tblCertificates.Add(certificate);
                db.SaveChanges();
                return(RedirectToAction("ApprovedStudent"));
            }


            return(View(registrationData));
        }
Ejemplo n.º 2
0
        public ActionResult Signup(tblUser td)
        {
            string   password = Utilities.Base64Encode(td.Password);
            tblUser  tb       = new tblUser();
            UserRole rb       = new UserRole();

            //tblCertificate ce = new tblCertificate();

            tb.Username = td.Username;
            tb.FullName = td.FullName;
            tb.Email    = td.Email;
            tb.Password = password;
            _db.tblUsers.Add(tb);

            rb.UserId = tb.UserId;
            rb.RoleId = 1;
            _db.UserRoles.Add(rb);

            tblCertificate tc = new tblCertificate();

            tc.IsVerified = false;

            //ce.UserId = td.UserId;
            //ce.GovernmentVerifiedImage = "";
            //_db.tblCertificates.Add(ce);

            _db.SaveChanges();
            return(RedirectToAction("Index", "Login"));
        }
Ejemplo n.º 3
0
        public ActionResult IssueCertificate(int?id)
        {
            IssueDetails issueDetails = new IssueDetails();


            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblCertificate tblCertificate = db.tblCertificates.Where(x => x.StudentId == id).FirstOrDefault();

            var registrationData = db.tblRegistrations.Where(a => a.StudentId == id).FirstOrDefault();



            issueDetails = (from a in db.tblRegistrations

                            where a.StudentId == id
                            select new IssueDetails
            {
                StudentId = a.StudentId,

                Name = a.Name,

                CourseId = a.CourseId,

                Certificate = a.Certificate,

                CertificateNo = a.CertificateNo
            }).FirstOrDefault();


            if (issueDetails == null)
            {
                return(HttpNotFound());
            }


            ViewBag.CourseId = new SelectList(db.tblCourses, "CourseId", "CourseName", issueDetails.CourseId);

            return(View(issueDetails));
        }
Ejemplo n.º 4
0
        public ActionResult ApplyForTeacher(tblCertificate tb)
        {
            HttpPostedFileBase fup = Request.Files["GovernmentVerifiedImage"];

            if (fup != null)
            {
                //string fileName =Convert.ToString( LoginController.UserID )+ fup.FileName;
                tb.GovernmentVerifiedImage = fup.FileName;
                tb.UserId     = LoginController.UserID;
                tb.IsVerified = false;
                fup.SaveAs(Path.Combine(Server.MapPath("~/img/certificate/" + fup.FileName)));
            }
            _db.tblCertificates.Add(tb);
            if (_db.SaveChanges() > 0)
            {
                return(RedirectToAction("ResponseCert", "User"));
            }


            return(View());
        }