public ActionResult Create(ScheduleAircraftReplacement scheduleaircraftreplacement)
 {
     if (ModelState.IsValid) {
         scheduleaircraftreplacementRepository.InsertOrUpdate(scheduleaircraftreplacement);
         scheduleaircraftreplacementRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
 public void InsertOrUpdate(ScheduleAircraftReplacement scheduleaircraftreplacement)
 {
     if (scheduleaircraftreplacement.ID == default(int)) {
         // New entity
         context.ScheduleAircraftReplacement.Add(scheduleaircraftreplacement);
     } else {
         // Existing entity
         context.ScheduleAircraftReplacement.Attach(scheduleaircraftreplacement);
         context.Entry(scheduleaircraftreplacement).State = EntityState.Modified;
     }
 }