public async Task <IActionResult> Register(RegisterDataView model)
        {
            if (ModelState.IsValid)
            {
                User user = new User {
                    Surname = model.Surname, Name = model.Name, Email = model.Email, UserName = model.Email, Phone = model.Phone
                };
                // добавляем пользователя
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    // установка куки
                    await _signInManager.SignInAsync(user, false);

                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError(string.Empty, error.Description);
                    }
                }
            }
            return(View(model));
        }
        public ActionResult Register(RegisterDataView detail)
        {
            var kontrol = _db.Customer.Where(e => (e.name == detail.adi && e.lastName == detail.soyadi) || e.eposta == detail.eposta).FirstOrDefault();

            if (kontrol != null)
            {
                Session.Add("mesaj", "Daha önceden müşteri kaydınız bulunmaktadır. Lütfen hatırlatma kısmından kullanıcı adı  ve şifre bilginizi öğreniniz");
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                using (TransactionScope scp = new TransactionScope())
                {
                    try
                    {
                        User user = new User();
                        user.userName = detail.kullaniciadi;
                        user.password = detail.sifre;
                        user.date     = DateTime.Now;
                        user.role_id  = (int)EnumHelper.Rol.musteri;
                        user.status   = (int)EnumHelper.Status.aktif;

                        Customer customer = new Customer();
                        customer.name     = detail.adi;
                        customer.lastName = detail.soyadi;
                        customer.eposta   = detail.eposta;
                        customer.phone    = detail.telefon;
                        customer.status   = (int)EnumHelper.Status.aktif;
                        user.Customer.Add(customer);
                        _db.User.Add(user);
                        _db.SaveChanges();
                        scp.Complete();
                    }
                    catch
                    {
                        return(RedirectToAction("Login", "Account"));
                    }
                    finally {
                        scp.Dispose();
                    }
                }
            }
            return(RedirectToAction("Index", "Hesabim", new { area = "KULLANICI" }));
        }