Example #1
0
        public IActionResult Eliminar(string id)
        {
            var Usuario = _context.Usuarios.Find(id);

            _context.Usuarios.Remove(Usuario);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public static void CreateBuilding(Building building)
        {
            var context = new CampusContext();

            context.Building.Add(building);
            context.SaveChanges();
        }
Example #3
0
        public static void CreateFloor(Floor floor)
        {
            var context = new CampusContext();

            context.Floor.Add(floor);
            context.SaveChanges();
        }
Example #4
0
        public IActionResult Crear(CrearViewModel crearViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(crearViewModel));
            }
            if (!_context.Grupos.Any(c => c.NumeroGrupo == crearViewModel.NumeroGrupo))
            {
                _context.Grupos.Add(new Grupos()
                {
                    NumeroGrupo = crearViewModel.NumeroGrupo, Horario = crearViewModel.Horario, CursoId = crearViewModel.CursoId
                });
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Example #5
0
        public IActionResult Crear(CrearViewModel crearViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(crearViewModel));
            }
            if (!_context.Cursos.Any(c => c.Nombre == crearViewModel.Nombre))
            {
                _context.Cursos.Add(new Curso()
                {
                    Nombre = crearViewModel.Nombre, Codigo = crearViewModel.Codigo, CarreraId = crearViewModel.CarreraId
                });
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Example #6
0
        public IActionResult Crear(CrearViewModel crearViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(crearViewModel));
            }
            if (!_context.Becas.Any(c => c.Nombre == crearViewModel.Nombre))
            {
                _context.Becas.Add(new Beca()
                {
                    Nombre = crearViewModel.Nombre, Porcentaje = crearViewModel.Porcentaje
                });
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View());
        }
 /// <summary>
 /// 续借指定id的借阅
 /// </summary>
 /// <param name="id">lend_id</param>
 public void ContinueLend(int id)
 {
     using (var t = dbcontext.Database.BeginTransaction())
     {
         try
         {
             dbcontext.Lends.Find(id).expire_time += new TimeSpan(14, 0, 0, 0);
             dbcontext.SaveChanges();
             t.Commit();
         }
         catch (Exception e)
         {
             t.Rollback();
         }
     }
 }
        public IActionResult Asignar(AsignarViewModel model)
        {
            var Curso = _context.Asistencias.Find(model.Lista);

            if (Curso != null)
            {
                Curso.Asistio = model.Asistio;
                _context.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Example #9
0
 public bool Commit()
 {
     return(_context.SaveChanges() > 0);
 }
Example #10
0
 public static void CreateAccount(Account acc)
 {
     context.Account.Add(acc);
     context.SaveChanges();
 }
Example #11
0
 public static void CreateStudent(Student stu)
 {
     context.Student.Add(stu);
     context.SaveChanges();
 }
Example #12
0
 public int SaveChanges()
 {
     return(Db.SaveChanges());
 }
Example #13
0
 public static void CreateDormRoom(DormRoom room)
 {
     context.DormRoom.Add(room);
     context.SaveChanges();
 }
 public static void CreateReservation(Reservation reservation)
 {
     context.Reservation.Add(reservation);
     context.SaveChanges();
 }