Пример #1
0
 public ActionResult Edit(Priority priority)
 {
     if (ModelState.IsValid)
     {
         unitofWork.PriorityRepository.InsertOrUpdate(priority);
         unitofWork.Save();
         return RedirectToAction("Index");
     }
     return View(priority);
 }
Пример #2
0
 public void InsertOrUpdate(Priority priority)
 {
     if (priority.PriorityID == default(int)) {
         // New entity
         context.Priorities.Add(priority);
     } else {
         // Existing entity
         context.Entry(priority).State = System.Data.Entity.EntityState.Modified;
     }
 }