public IActionResult Register()
        {
            CareerExpertRegisterModel model = new CareerExpertRegisterModel();

            model = LoadModel(ref model);
            return(View(model));
        }
        public IActionResult Register(CareerExpertRegisterModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var singleUser = _context.Users.Where(x => x.Email == model.Email).AsNoTracking();
                    if (!singleUser.Any())
                    {
                        List <IFormFile> list = new List <IFormFile>();
                        if (model.ImageFile != null)
                        {
                            list.Add(model.ImageFile);
                        }

                        CareerExpert careerExpertData = new CareerExpert()
                        {
                            FirstName        = model.FirstName,
                            LastName         = model.LastName,
                            Email            = model.Email,
                            AlternateContact = model.AlternateContact,
                            ContactNo        = model.ContactNo,
                            DOB                = model.DOB,
                            Description        = model.Description,
                            Address            = model.Address,
                            Gender             = Enum.GetName(typeof(Gender), model.GenderId),
                            StateId            = model.StateId,
                            CityId             = model.CityId,
                            Pincode            = model.PincodeId,
                            TeachingExperience = model.TeachingExperience
                        };
                        (int studentId, string uniqueNo) = _classBookService.SaveCareerExpert(careerExpertData, list);
                        string UserName = careerExpertData.FirstName + uniqueNo;
                        var    user     = _classBookService.SaveUserData(studentId, Module.Student, UserName, careerExpertData.Email);
                        //var rest = _classBookService.RegisterMethod(model, "/api/v1/ChannelPartner/register");
                        _classBookService.SendVerificationLinkEmail(careerExpertData.Email, user.Password, Module.Student.ToString());
                        return(RedirectToAction("Register"));
                    }
                    else
                    {
                        ModelState.AddModelError("Email", "Email Id Already Exist");
                        model = LoadModel(ref model);
                    }
                    return(View(model));
                }
                else
                {
                    model = LoadModel(ref model);
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                _logsService.InsertLogs("CareerExpert", ex, "CareerExpert", 0);
                return(RedirectToAction("Register"));
            }
        }
 protected CareerExpertRegisterModel LoadModel(ref CareerExpertRegisterModel model)
 {
     model.States     = _classBookModelFactory.PrepareStateDropDown();
     model.GenderList = _classBookModelFactory.PrepareGenderDropDown();
     return(model);
 }