public ActionResult Create(person collection) { try { using (induccionEntities entity = new induccionEntities()) { entity.people.Add(collection); entity.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, person collection) { try { using (induccionEntities entity = new induccionEntities()) { entity.Entry(collection).State = System.Data.Entity.EntityState.Modified; entity.SaveChanges(); } return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public ActionResult Delete(int id, person collection) { try { person users = new person(); using (induccionEntities entity = new induccionEntities()) { users = entity.people.Where(entityPerson => entityPerson.id == id).FirstOrDefault(); entity.people.Remove(users); entity.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }