public async Task <IActionResult> Create(Adres adres)
        {
            _db.Adres.Add(adres);
            await _db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                Passenger passenger = await _db.Passenger.FirstOrDefaultAsync(u => u.Email == model.Email);

                if (passenger == null)
                {
                    // добавляем пользователя в бд
                    _db.Passenger.Add(new Passenger {
                        Email = model.Email, Password = model.Password, Name = model.Name, PhoneNumber = model.PhoneNumber
                    });
                    await _db.SaveChangesAsync();

                    await Authenticate(model.Email); // аутентификация

                    return(RedirectToAction("UserDetails", "Account"));
                    //return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", "Некорректные логин и(или) пароль");
                }
            }
            return(View(model));
        }
        public async Task <IActionResult> GiveRating(Order order)
        {
            _newOrder.Grade         = order.Grade;
            _newOrder.PassengerId   = _order.PassengerId;
            _newOrder.AdresId       = 2;
            _newOrder.PaymentTypeId = 14;
            _newOrder.CarId         = _order.CarId;
            _newOrder.Distance      = _rnd.Next(50, 150);
            _db.Order.Update(_newOrder);
            await _db.SaveChangesAsync();

            //return RedirectToAction();
            return(RedirectToAction("Index"));
        }