public ActionResult Create(DriverLicense driverlicense) { if (ModelState.IsValid) { driverlicenseRepository.InsertOrUpdate(driverlicense); driverlicenseRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(DriverLicense driverlicense) { if (driverlicense.DriverLicenseID == default(int)) { // New entity context.DriverLicense.Add(driverlicense); } else { // Existing entity context.Entry(driverlicense).State = EntityState.Modified; } }
public ViewResult Search(DriverLicense searchDriverLicense) { if(searchDriverLicense!=null) { } return View("Index",driverlicenseRepository.All); }