public ActionResult Edit(int id)
        {
            var driver = _context.Drivers.SingleOrDefault(d => d.Id == id);

            if (driver == null)
            {
                return(HttpNotFound());
            }
            var viewModel = new DriverFormViewModel(driver);

            return(View("DriverForm", viewModel));
        }
        public ActionResult Save(Driver driver)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new DriverFormViewModel(driver);
                return(View("DriverForm", viewModel));
            }
            if (driver.Id == 0)
            {
                _context.Drivers.Add(driver);
            }
            else
            {
                var driverInDb = _context.Drivers.Single(d => d.Id == driver.Id);
                driverInDb.Name           = driver.Name;
                driverInDb.PhoneNumber    = driver.PhoneNumber;
                driverInDb.PersonalNumber = driver.PersonalNumber;
            }
            _context.SaveChanges();

            return(RedirectToAction("Index", "Driver"));
        }
        public ActionResult New()
        {
            var viewModel = new DriverFormViewModel();

            return(View("DriverForm", viewModel));
        }