Beispiel #1
0
        public IActionResult EditDriver(string id)
        {
            EditDriverVM model = null;
            var          user  = _userManger.FindByIdAsync(id).Result;

            if (user != null)
            {
                model             = new EditDriverVM();
                model.FirstName   = user.FirstName;
                model.LastName    = user.LastName;
                model.Email       = user.Email;
                model.PhoneNumber = user.PhoneNumber;
                model.Id          = user.Id;

                var driver = _listOfAll.GetDriverByUserId(id);
                if (driver != null)
                {
                    model.Address = driver.Address_Location;
                }
                model.Area = _listOfAll.GetArea()?.Select(p => new SelectListItem()
                {
                    Text  = p.AreaName,
                    Value = p.Id.ToString()
                }).ToList();
            }

            return(View(model));
        }
Beispiel #2
0
        public IActionResult List()
        {
            var data = _userManger.Users.ToList();
            List <SignUpDriverVM> model = new List <SignUpDriverVM>();

            if (data != null)
            {
                foreach (var item in data)
                {
                    if (_userManger.IsInRoleAsync(item, "Driver").Result)
                    {
                        var            driverData = _listOfAll.GetDriverByUserId(item.Id);
                        SignUpDriverVM listVM     = new SignUpDriverVM();
                        listVM.Id          = item.Id;
                        listVM.FirstName   = item.FirstName;
                        listVM.LastName    = item.LastName;
                        listVM.Email       = item.Email;
                        listVM.PhoneNumber = item.PhoneNumber;
                        listVM.Address     = driverData.Address_Location;
                        model.Add(listVM);
                    }
                }
            }
            return(View(model));
        }