public void InsertOrUpdate(RELEASE release) { if (release.ID == default(int)) { // New entity context.RELEASE.Add(release); } else { // Existing entity context.Entry(release).State = System.Data.Entity.EntityState.Modified; } }
public ActionResult Edit(RELEASE release) { if (ModelState.IsValid) { releaseRepository.InsertOrUpdate(release); releaseRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }