Пример #1
0
        public ActionResult Register(Customer customer)
        {
            if (customer != null)
            {
                customer.CreatedDate  = DateTime.Now;
                customer.ProfileImage = "/img/bay.png";
                if (_customerServices.AnyUsername(customer.UserName))
                {
                    ModelState.AddModelError("", "bu kullanici adi kullaniliyor");
                }
                else if (_customerServices.AnyEmail(customer.Email))
                {
                    ModelState.AddModelError("", "bu email  kullaniliyor");
                }
                else if (_customerServices.AnyUsername(customer.UserName) == false && _customerServices.AnyEmail(customer.Email) == false)
                {
                    // Crypto.Hash(customer.Password, "md5");
                    _customerServices.Register(customer);
                    ModelState.AddModelError("", "Başarıyla kayıt oldunuz.");
                    System.Threading.Thread.Sleep(3000);
                    return(RedirectToAction("Login", "Customer"));
                }
            }

            return(View(customer));
        }