Exemplo n.º 1
0
        public User DeleteUserById(int id)
        {
            var userRemoved = _context.Remove <User>(new User()
            {
                Id = id
            }).Entity;

            _context.SaveChanges();
            return(userRemoved);
        }
        public GroupSpace DeleteGroupSpaceById(string id)
        {
            var groupSpaceRemoved = _context.Remove <GroupSpace>(new GroupSpace()
            {
                Id = Guid.Parse(id)
            }).Entity;

            _context.SaveChanges();
            return(groupSpaceRemoved);
        }
 public void Write(int dni, string nombre)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Alumno alumno = new Alumno()
         {
             Dni    = dni,
             Nombre = nombre
         };
         dbContext.Add(alumno);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void Write(string tema, string fecha)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         TFC tfc = new TFC()
         {
             Tema  = tema,
             Fecha = fecha
         };
         dbContext.Add(tfc);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void Write(string nombre_grupo, int num_componente)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Grupo grupo = new Grupo()
         {
             Nombre_grupo   = nombre_grupo,
             Num_componente = num_componente
         };
         dbContext.Add(grupo);
         dbContext.SaveChanges();
     }
 }
 public void Write(string lugar_examen, int num_componentes)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Tribunal tribunal = new Tribunal()
         {
             Lugar_Examen    = lugar_examen,
             Num_Componentes = num_componentes
         };
         dbContext.Add(tribunal);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void Delete(int num_grupo)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Grupo grupo = dbContext.Grupos(true)
                       .Where(s => s.Num_grupo == num_grupo)
                       .FirstOrDefault();
         if (grupo != null)
         {
             dbContext.Remove(grupo);
             dbContext.SaveChanges();
         }
     }
 }
 public void Delete(int num)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Tribunal tribunal = dbContext.Tribunales(true)
                             .Where(s => s.Num == num)
                             .FirstOrDefault();
         if (tribunal != null)
         {
             dbContext.Remove(tribunal);
             dbContext.SaveChanges();
         }
     }
 }
Exemplo n.º 9
0
 public void Delete(int dni)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Profesor profesor = dbContext.Profesores(true)
                             .Where(s => s.DNI == dni)
                             .FirstOrDefault();
         if (profesor != null)
         {
             dbContext.Remove(profesor);
             dbContext.SaveChanges();
         }
     }
 }
 public void Delete(int num_matricula)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Alumno alumno = dbContext.Alumnos(true)
                         .Where(s => s.Num_Matricula == num_matricula)
                         .FirstOrDefault();
         if (alumno != null)
         {
             dbContext.Remove(alumno);
             dbContext.SaveChanges();
         }
     }
 }
Exemplo n.º 11
0
 public void Write(int dni, string nombre, string domicilio)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         Profesor profesor = new Profesor()
         {
             DNI       = dni,
             Nombre    = nombre,
             Domicilio = domicilio
         };
         dbContext.Add(profesor);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 12
0
 public void Delete(int num_orden)
 {
     using (GlobalDbContext dbContext = new GlobalDbContext())
     {
         TFC tfc = dbContext.TFCs(true)
                   .Where(s => s.Num_orden == num_orden)
                   .FirstOrDefault();
         if (tfc != null)
         {
             dbContext.Remove(tfc);
             dbContext.SaveChanges();
         }
     }
 }
Exemplo n.º 13
0
        public void Update(int num_orden, string tema, string fecha)
        {
            using (GlobalDbContext dbContext = new GlobalDbContext())
            {
                TFC tfc = dbContext.TFCs(true)
                          .Where(s => s.Num_orden == num_orden)
                          .FirstOrDefault();
                if (tfc != null)
                {
                    tfc.Tema  = tema;
                    tfc.Fecha = fecha;

                    dbContext.SaveChanges();
                }
            }
        }
Exemplo n.º 14
0
        public void Update(int num_grupo, string nombre_grupo, int num_componente)
        {
            using (GlobalDbContext dbContext = new GlobalDbContext())
            {
                Grupo grupo = dbContext.Grupos(true)
                              .Where(s => s.Num_grupo == num_grupo)
                              .FirstOrDefault();
                if (grupo != null)
                {
                    grupo.Nombre_grupo   = nombre_grupo;
                    grupo.Num_componente = num_componente;

                    dbContext.SaveChanges();
                }
            }
        }
        public void Update(int num_matricula, int dni, string nombre)
        {
            using (GlobalDbContext dbContext = new GlobalDbContext())
            {
                Alumno alumno = dbContext.Alumnos(true)
                                .Where(s => s.Num_Matricula == num_matricula)
                                .FirstOrDefault();
                if (alumno != null)
                {
                    alumno.Dni    = dni;
                    alumno.Nombre = nombre;

                    dbContext.SaveChanges();
                }
            }
        }
        public void Update(int num, string lugar_examen, int num_componentes)
        {
            using (GlobalDbContext dbContext = new GlobalDbContext())
            {
                Tribunal tribunal = dbContext.Tribunales(true)
                                    .Where(s => s.Num == num)
                                    .FirstOrDefault();
                if (tribunal != null)
                {
                    tribunal.Lugar_Examen    = lugar_examen;
                    tribunal.Num_Componentes = num_componentes;

                    dbContext.SaveChanges();
                }
            }
        }
Exemplo n.º 17
0
        public void Update(int dni, string nombre, string domicilio)
        {
            using (GlobalDbContext dbContext = new GlobalDbContext())
            {
                Profesor profesor = dbContext.Profesores(true)
                                    .Where(s => s.DNI == dni)
                                    .FirstOrDefault();
                if (profesor != null)
                {
                    profesor.DNI       = dni;
                    profesor.Nombre    = nombre;
                    profesor.Domicilio = domicilio;

                    dbContext.SaveChanges();
                }
            }
        }
 public UserGroupSpace DeleteRefereceById(string groupSpaceId, int userId)
 {
     var referenceRemoved = _context.Remove<UserGroupSpace>(new UserGroupSpace() { GroupSpaceId = Guid.Parse(groupSpaceId), UserId = userId }).Entity;
     _context.SaveChanges();
     return referenceRemoved;
 }
Exemplo n.º 19
0
        public IActionResult SetupDatabase()
        {
            lock (setupLock)
            {
                using (var context = new GlobalDbContext())
                {
                    // Create database
                    context.Database.EnsureCreated();

                    Customer c1 = new Customer()
                    {
                        Name        = "Niccolo",
                        Surname     = "Consoli",
                        DateOfBirth = new DateTime(1992, 1, 1),
                    };
                    Customer c2 = new Customer()
                    {
                        Name        = "Riccardo",
                        Surname     = "Andro",
                        DateOfBirth = new DateTime(1992, 1, 1),
                    };
                    Customer c3 = new Customer()
                    {
                        Name        = "Gianluca",
                        Surname     = "Aziella",
                        DateOfBirth = new DateTime(1992, 1, 1),
                    };
                    Customer c4 = new Customer()
                    {
                        Name        = "Gigi",
                        Surname     = "Buffon",
                        DateOfBirth = new DateTime(1987, 1, 1),
                    };


                    Vehicle s2 = new Vehicle()
                    {
                        Brand = "Ferrari",
                        Model = "Rossa",
                        Price = "10000000",
                    };
                    Vehicle s3 = new Vehicle()
                    {
                        Brand = "Mercedez",
                        Model = "XLK-9",
                        Price = "50000",
                    };
                    Vehicle s4 = new Vehicle()
                    {
                        Brand = "BMW",
                        Model = "Serie A",
                        Price = "250000",
                    };
                    Vehicle s5 = new Vehicle()
                    {
                        Brand = "Opel",
                        Model = "Meriva",
                        Price = "90000",
                    };


                    context.Vehicles.Add(s2);
                    context.Vehicles.Add(s3);
                    context.Vehicles.Add(s4);
                    context.Vehicles.Add(s5);
                    context.Customers.Add(c1);
                    context.Customers.Add(c2);
                    context.Customers.Add(c3);
                    context.Customers.Add(c4);
                    context.SaveChanges();
                }
                return(Ok("database created"));
            }
        }