예제 #1
0
 public ActionResult Create(MedicType medictype)
 {
     if (ModelState.IsValid) {
         medictypeRepository.InsertOrUpdate(medictype);
         medictypeRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
예제 #2
0
 public void InsertOrUpdate(MedicType medictype)
 {
     if (medictype.medicTypeID == default(int)) {
         // New entity
         context.MedicTypes.Add(medictype);
     } else {
         // Existing entity
         context.Entry(medictype).State = EntityState.Modified;
     }
 }