Exemple #1
0
        public async Task <IActionResult> PutProfesor(int id, Models.Profesor profesor)
        {
            if (id != profesor.IdProfesor)
            {
                return(BadRequest());
            }

            try
            {
                var aux = _mapper.Map <Models.Profesor, data.Profesor>(profesor);
                new BS.Profesor(_context).Update(aux);
            }
            catch (Exception ee)
            {
                if (!ProfesorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <Models.Profesor> > PostProfesor(Models.Profesor profesor)
        {
            var aux = _mapper.Map <Models.Profesor, data.Profesor>(profesor);

            new BS.Profesor(_context).Insert(aux);

            return(CreatedAtAction("GetProfesor", new { id = profesor.IdProfesor }, profesor));
        }
Exemple #3
0
 public CreateGrupoDTO(int numGrupo, int idMateria, string tipoIdentificacionEmpleado, string numeroIdentificacionEmpleado, Models.Materia idMateriaNavigation, Models.Profesor profesor, ICollection <GrupoHorario> grupoHorario)
 {
     NumGrupo  = numGrupo;
     IdMateria = idMateria;
     TipoIdentificacionEmpleado   = tipoIdentificacionEmpleado;
     NumeroIdentificacionEmpleado = numeroIdentificacionEmpleado;
     IdMateriaNavigation          = idMateriaNavigation;
     Profesor     = profesor;
     GrupoHorario = grupoHorario;
 }
Exemple #4
0
 private WebApplication5.Models.Profesor BuscarProfesor(int cg)
 {
     WebApplication5.Models.Profesor nueva = new Models.Profesor();
     foreach (WebApplication5.Models.Profesor profesor in listado)
     {
         if (profesor.cg == cg)
         {
             nueva = profesor;
         }
     }
     return(nueva);
 }
Exemple #5
0
        public ActionResult Crear(Models.Profesor p)
        {
            var profesores = Servicio.DatosProfesor.Profesores();

            if (profesores.Any(m => m.Nombre == p.Nombre))
            {
                Utils.MensajesUI.SetError("Ya existe un usuario con ese nombre");
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                Servicio.DatosProfesor.Profesores().Add(p);
                return(RedirectToAction("Index", "Profesor"));
            }
        }