コード例 #1
0
 public string AddTeacherCertification(QualificationParam model)
 {
     try
     {
         string imageName        = "";
         TeacherCertification td = new TeacherCertification();
         if (Request.Files.Count > 0)
         {
             var file = Request.Files[0];
             if (file != null)
             {
                 imageName = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);
                 string path = Path.Combine(Server.MapPath("~/Uploads/CertificateFiles/"), imageName);
                 file.SaveAs(path);
                 td.Image = imageName;
             }
         }
         UnitOfWork uow    = new UnitOfWork();
         var        userId = Session["UserId"].ToString();
         td.Title        = model.DegreeTitle;
         td.Institute    = model.InstituteName;
         td.TeacherId    = userId;
         td.Year         = model.YearPassed;
         td.CreationDate = DateTime.Now;
         td.IsActive     = true;
         uow.TeacherCertifications.Insert(td);
         uow.Save();
         return("true");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
コード例 #2
0
 public bool AddTeacherLanguage(QualificationParam model)
 {
     try
     {
         UnitOfWork      uow    = new UnitOfWork();
         var             userId = Session["UserId"].ToString();
         TeacherLanguage tl     = new TeacherLanguage();
         tl.LangLevel = model.LanguageLevel;
         tl.Language  = model.LanguageID;
         tl.TeacherID = userId;
         uow.TeacherLanguages.Insert(tl);
         uow.Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #3
0
 public bool AddTeacherQualification(QualificationParam model)
 {
     try
     {
         UnitOfWork           uow    = new UnitOfWork();
         var                  userId = Session["UserId"].ToString();
         TeacherQualification td     = new TeacherQualification();
         td.DegreeTitle   = model.DegreeTitle;
         td.InstituteName = model.InstituteName;
         td.TeacherID     = userId;
         td.YearPassed    = model.YearPassed;
         td.CreationDate  = DateTime.Now;
         td.Status        = 1;
         uow.TeacherQualifications.Insert(td);
         uow.Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }