Exemplo n.º 1
0
        public ActionResult Create(person collection)
        {
            try
            {
                using (induccionEntities entity = new induccionEntities())
                {
                    entity.people.Add(collection);
                    entity.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 2
0
        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());
            }
        }
Exemplo n.º 3
0
        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());
            }
        }