public ActionResult Create(OPERACIONE operacione) { if (ModelState.IsValid) { operacioneRepository.InsertOrUpdate(operacione); operacioneRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(OPERACIONE operacione) { if (operacione.ID == default(decimal)) { // New entity context.OPERACIONEs.Add(operacione); } else { // Existing entity context.Entry(operacione).State = EntityState.Modified; } }