public ActionResult Edit(TAREA tarea) { if (ModelState.IsValid) { tareaRepository.InsertOrUpdate(tarea); tareaRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(TAREA tarea) { if (tarea.ID == default(int)) { // New entity context.TAREA.Add(tarea); } else { // Existing entity context.Entry(tarea).State = System.Data.Entity.EntityState.Modified; } }
public ActionResult CreateTarea(TAREA tarea) { if (ModelState.IsValid){ tarea.IDUSERSTORY = tmpIdUserStory; db.TAREA.Add(tarea); db.SaveChanges(); return RedirectToAction("Index"); } else { return View(); } }