public ActionResult Register(RegisterModel model, bool captchaValid, string captchaErrorMessage)
 {
     if (ModelState.IsValid)
     {
         if (model != null)
         {
             if (!captchaValid)
             {
                 ViewData["Message"] = "Invalid Captcha.";
                 ModelState.AddModelError("captcha", captchaErrorMessage);
             }
             else
             {
                 Member member = new Member();
                 member.EmailId = model.Email;
                 member.FirstName = model.FirstName;
                 member.LastName = model.LastName;
                 string[] result = model.PhoneCode.Split(new char[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries);
                 member.PhoneNo = !string.IsNullOrEmpty(model.PhoneNumber) ? string.Format("{0} {1}", result[0], model.AreaCode, model.PhoneNumber) : "";
                 if (!string.IsNullOrEmpty(model.Password))
                 {
                     member.Password = CryptorEngine.Encrypt(model.Password, true);
                     member.CreatedOn = DateTime.Now;
                     member.isActive = true;
                     if (!string.IsNullOrEmpty(model.Password))
                     {
                         Int32 memberID = Logininfo.GetMemberId(model.Email, "");
                         if (memberID > 0)
                         {
                             ViewData["Message"] = string.Format("Emailid {0} already exists.please try alternate email.", model.Email);
                         }
                         else
                         {
                             Logininfo.AddMember(member);
                             ViewData["Message"] = "Registration Successful.";
                         }
                     }
                     return View();
                 }
             }
         }
     }
     return View("Register");
 }
Пример #2
0
 public static MySqlDataReader AddMember(Member member)
 {
     return AccountAccess.AddMember(member.FirstName, member.LastName, member.Password, member.PhoneNo, DateTime.Now, member.EmailId);
 }