public ActionResult Create([Bind(Include = "DriverName,DriverMobileNo,AssignedTT")] Driver driver) { if (ModelState.IsValid) { TankTruckRepository tt = new TankTruckRepository(_sqlConnectionString); if (tt.VerifyTruckNo(driver.AssignedTT)) { _driverRepository.Create(driver); return RedirectToAction("Index"); } driver.AssignedTT = string.Empty; return View(driver); } return View(); }
public ActionResult Edit([Bind(Include = "Id,DriverName,DriverMobileNo,AssignedTT")] Driver driver) { if (ModelState.IsValid) { TankTruckRepository tt = new TankTruckRepository(_sqlConnectionString); if (tt.VerifyTruckNo(driver.AssignedTT)) { _driverRepository.Update(driver); //return Redirect(Request.UrlReferrer.ToString()); return RedirectToAction("Index"); } driver.AssignedTT = string.Empty; return View(driver); } return View(); }