public IActionResult Registration(RegistrationViewModel model)
        {
            if (ModelState.IsValid)
            {
                string password = model.CandidateName.Substring(0, 4).ToUpper() + model.Mobile.Substring(0, 4);

                Console.WriteLine(password);
                Registation registation = new Registation()
                {
                    CandidateName      = model.CandidateName,
                    Email              = model.Email,
                    Mobile             = model.Mobile,
                    ExaminationApplied = model.ExaminationApplied,
                    Password           = password
                };

                bool status = _repositry.Add(registation);
                if (status)
                {
                    Registation reg = _repositry.GetRegistationById(model.Email);
                    TempData.Add("Reg", reg.Registration_number);
                    TempData.Add("Password", reg.Password);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View(new RegistrationViewModel()));
        }
Exemple #2
0
        public IActionResult Registration(RegistrationViewModel model)
        {
            if (ModelState.IsValid)
            {
                string password = model.CandidateName.Substring(0, 4).ToUpper() + model.Mobile.Substring(0, 4);
                Console.WriteLine(password);
                Registation registation = new Registation()
                {
                    CandidateName      = model.CandidateName,
                    Email              = model.Email,
                    Mobile             = model.Mobile,
                    ExaminationApplied = model.ExaminationApplied,
                    Password           = password
                };

                _repositry.Add(registation);
            }
            return(View());
        }