// GET: Person/Edit/5 public ActionResult Edit(int id) { induccionEntities entity = new induccionEntities(); person person = new person(); using (entity) { person = entity.people.Where(entityPerson => entityPerson.id == id).FirstOrDefault(); } return(View(person)); }
// GET: Person public ActionResult Index() { induccionEntities entity = new induccionEntities(); List <person> person = new List <person>(); using (entity) { person = entity.people.ToList(); } return(View(person)); }
public ActionResult About() { induccionEntities entity = new induccionEntities(); List <person> person = new List <person>(); using (entity) { person = entity.people.ToList(); } ViewBag.Message = "Your application description page."; return(View(person)); }
public person GetPerson() { induccionEntities entity = new induccionEntities(); person person = new person(); gender gender = new gender(); using (entity) { person = entity.people.SqlQuery("SELECT P.id, P.name, surname, age, identification, sex FROM person P ").FirstOrDefault(); person.gender = entity.genders.Where(X => X.id == person.id).FirstOrDefault(); } return(person); }
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 Create(person collection) { try { using (induccionEntities entity = new induccionEntities()) { entity.people.Add(collection); entity.SaveChanges(); } return(RedirectToAction("Index")); } catch { 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()); } }