Пример #1
0
        public ActionResult Signup(RegistrationViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                bool IsExist = _RegistrationRepository.IsEmailExist(model.Email);

                if (IsExist == true)
                {
                    ViewBag.errorMessage = "Email already exist.";
                    return(View(model));
                }

                Registration objRegistration = new Registration();
                objRegistration.Email          = model.Email;
                objRegistration.Password       = model.Password;
                objRegistration.FirstName      = model.FirstName;
                objRegistration.UpdatedDate    = DateTime.Now.Date;
                objRegistration.ExpireDate     = DateTime.Now.Date;
                objRegistration.ActiveStatus   = true;
                objRegistration.MemberType     = ConfigurationManager.AppSettings["MemberType"];
                objRegistration.MemberShipType = ConfigurationManager.AppSettings["MemberShipType"];
                objRegistration.PaymentStatus  = false;
                _RegistrationRepository.AddClient(objRegistration);
                _RegistrationRepository.SaveAll();
                return(RedirectToAction("Login", "Account"));
            }
            catch (Exception ex)
            {
                ViewBag.errorMessage = ex.Message + "Fail Reigistration";
                return(View(model));
            }
        }