Ejemplo n.º 1
0
        public ActionResult Edit(int id, DriverViewModel model)
        {
            try
            {
                Domain.Driver.Driver driver = _driverService.GetDriverById(id);
                driver.Name                       = model.Name;
                driver.NIC                        = model.NIC;
                driver.DateOfBirth                = model.DateOfBirth;
                driver.ResidentAddress            = model.ResidentAddress;
                driver.ContactNumber1             = model.ContactNumber1;
                driver.ContactNumber2             = model.ContactNumber2;
                driver.EPFNumber                  = model.EPFNumber;
                driver.DLNumber                   = model.DLNumber;
                driver.DateOfExpiryLicense        = model.DateOfExpiryLicense;
                driver.DefensiveLicenseNumber     = model.DefensiveLicenseNumber;
                driver.DefensiveLicenseExpiryDate = model.DefensiveLicenseExpiryDate;
                driver.DriverGrade                = model.DriverGrade;
                driver.StartDateOfWork            = model.StartDateOfWork;
                driver.PeriodOfService            = model.PeriodOfService;
                driver.BasicSalary                = model.BasicSalary;
                driver.MinimumSalary              = model.MinimumSalary;
                driver.PoliceReportExpiryDate     = model.PoliceReportExpiryDate;
                _driverService.SaveDriver(driver);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 2
0
        public void DeleteDriver(int id)
        {
            Domain.Driver.Driver driver = GetDriverById(id);

            if (driver != null)
            {
                _driverResitory.Delete(driver);
                _driverResitory.Save(driver);
            }
        }
Ejemplo n.º 3
0
 // GET: Driver/Edit/5
 public ActionResult Edit(int id)
 {
     try
     {
         Domain.Driver.Driver driver = _driverService.GetDriverById(id);
         DriverViewModel      model  = Mapper.Map <DriverViewModel>(driver);
         return(View(model));
     }
     catch
     {
         return(View());
     }
 }
Ejemplo n.º 4
0
 public void SaveDriver(Domain.Driver.Driver driver)
 {
     _driverResitory.SaveDriver(driver);
 }