public IActionResult Login(UserLoginModel u)
        {
            bool status;
            TutorProfileModel tp  = new TutorProfileModel();
            UserDB            udb = new UserDB();
            StepsDB           sdb = new StepsDB();

            tp.TutorProfile = udb.UserLogin(u.Email, u.Password, GetConfiguration().GetConnectionString("DefaultConnection"));
            if (tp.TutorProfile != null)
            {
                HttpContext.Session.SetString("UserName", tp.TutorProfile.FirstName + "." + tp.TutorProfile.LastName);
                HttpContext.Session.SetInt32("UserId", (int)tp.TutorProfile.UserId);
                HttpContext.Session.SetInt32("TutorId", (int)tp.TutorProfile.Id);
                status = sdb.CheckCompletedSteps(tp.TutorProfile.UserId, 1, tp.TutorProfile.Id, GetConfiguration().GetConnectionString("DefaultConnection"));
                if (status == true)
                {
                    return(RedirectToAction("Subjects", "TutorProfile"));
                }
                else
                {
                    return(RedirectToAction("Questionnaire", "TutorProfile"));
                }
            }
            else
            {
                ViewData["Message"] = "User Login Details failed !!";
            }
            return(View());
        }
Ejemplo n.º 2
0
        private TutorProfileModel InitModel()
        {
            var dbTutor = BLL.Data.TutorData.GetTutor(((CustomPrincipal)User).UserId);
            var model   = new TutorProfileModel
            {
                Tutor = new TutorModel(dbTutor)
            };

            ViewBag.LessonTypes  = BLL.Data.TutorData.GetTutorsLessonTypes(model.Tutor.id);
            ViewBag.LessonLevels = BLL.Data.TutorData.GetTutorsLessonLevels(model.Tutor.id);
            ViewBag.Subjects     = BLL.Data.TutorData.GetTutorsSubjects(model.Tutor.id);
            return(model);
        }
        public IActionResult SignUp(UserSignUpModel u)
        {
            TutorProfileModel tp  = new TutorProfileModel();
            UserDB            udb = new UserDB();

            tp.TutorProfile = udb.UserSignUp(u.LegalFN, u.LegalLN, u.Email, u.Password, u.CountryId, GetConfiguration().GetConnectionString("DefaultConnection"));
            if (tp.TutorProfile != null)
            {
                HttpContext.Session.SetString("UserName", tp.TutorProfile.FirstName + "." + tp.TutorProfile.LastName);
                HttpContext.Session.SetInt32("UserId", (int)tp.TutorProfile.UserId);
                return(RedirectToAction("Questionnaire", "TutorProfile"));
            }
            else
            {
                ViewData["Message"] = "User Login Details failed !!";
            }
            return(View());
        }
 public void InsertTutorDetails(TutorProfileModel lstTutorProfile)
 {
 }