public static void Guardar(Grupos G)
        {
            try
            {
                DetallesDb db = new DetallesDb();

                db.Grupo.Add(G);
                foreach (var est in G.Estudiante)
                {
                    db.Entry(est).State = System.Data.Entity.EntityState.Unchanged;
                }
                db.SaveChanges();
                db.Dispose();
            }catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public static bool Insertar(Grupos nuevo)
        {
            bool retorno = false;

            try
            {
                var db = new DetallesDb();

                db.Grupo.Add(nuevo);
                foreach (var estudiante in nuevo.Estudiante)
                {
                    db.Entry(nuevo).State = System.Data.Entity.EntityState.Unchanged;
                }
                db.SaveChanges();

                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }