public IActionResult Approve(string id)
        {
            MyIdentityUser user = _context.GetUser(id);

            user.DriverStatus = "Accepted";
            _userManager.AddToRoleAsync(user, "Driver");
            _context.Update(user);
            _context.SaveChanges();

            var subject = "Request to Become Driver Accepted";
            var message = "Congratulations, your request to become a driver has been accepted!";

            new Mailer().SendMail(subject, user.Email, message);

            return(RedirectToAction("RequestDriver"));
        }
        public IActionResult UpdateUser(UserViewModel user)
        {
            var identityUser = _identityContext.Users
                               .Where(x => x.Id == User.FindFirstValue(ClaimTypes.NameIdentifier))
                               .Include(x => x.Address).ToList().ElementAt(0);

            identityUser.Address.StreetNumber = user.Address.StreetNumber;
            identityUser.Address.StreetName   = user.Address.StreetName;
            identityUser.Address.City         = user.Address.City;
            identityUser.Address.State        = user.Address.State;
            identityUser.Address.ZipCode      = user.Address.ZipCode;

            identityUser.PhoneNumber = user.Phone;
            identityUser.Email       = user.Email;

            _identityContext.Update(identityUser);
            _identityContext.SaveChanges();

            return(RedirectToAction("Index"));
        }
        public static void SeedRequests(MyProductionDbContext context,
                                        UserManager <MyIdentityUser> userManager)
        {
            // users
            MyIdentityUser zafer  = userManager.FindByNameAsync("zafer").Result;
            MyIdentityUser mattar = userManager.FindByNameAsync("mattar").Result;
            MyIdentityUser josh   = userManager.FindByNameAsync("josh").Result;

            //drivers
            MyIdentityUser gavin = userManager.FindByNameAsync("gavin").Result;
            MyIdentityUser sean  = userManager.FindByNameAsync("sean").Result;
            MyIdentityUser anas  = userManager.FindByNameAsync("anas").Result;

            RequestModel zaferRequest = new RequestModel
            {
                Item           = "Vape",
                UserId         = zafer.Id,
                DriverId       = anas.Id,
                PickupAddress  = anas.Address,
                DropOffAddress = zafer.Address,
                Status         = "Accepted By Driver",
                ImageName      = "vape.png"
            };

            context.Requests.Add(zaferRequest);

            RequestModel mattarRequest = new RequestModel
            {
                Item           = "Hijab",
                UserId         = mattar.Id,
                PickupAddress  = gavin.Address,
                DropOffAddress = gavin.Address,
                Status         = "Awaiting Driver",
                ImageName      = "hijab.jpg"
            };

            context.Requests.Add(mattarRequest);

            RequestModel joshRequest = new RequestModel
            {
                Item           = "American flag",
                UserId         = josh.Id,
                PickupAddress  = sean.Address,
                DropOffAddress = sean.Address,
                Status         = "Awaiting Driver",
                ImageName      = "flag.jpg"
            };

            context.Requests.Add(joshRequest);
            context.SaveChanges();
        }