public bool Put(c_Profesores prfs, int id) { using (CursoEscolarEntities contexto = new CursoEscolarEntities()) { Profesor editProfesor = (from Prof in contexto.Profesor where Prof.Prf_Id == id select Prof).FirstOrDefault(); editProfesor.Prf_Nombre = prfs.Nombre; editProfesor.Prf_Apellido = prfs.Apellido; editProfesor.Prf_Area_Id = prfs.Area; contexto.SaveChanges(); } return(true); }
// POST: api/Profesor public bool Post(c_Profesores profesor) { Boolean guardar = false; using (CursoEscolarEntities contexto = new CursoEscolarEntities()) { Profesor profesor1 = new Profesor { Prf_Nombre = profesor.Nombre, Prf_Apellido = profesor.Apellido, Prf_Area_Id = profesor.Area }; contexto.Profesor.Add(profesor1); contexto.SaveChanges(); guardar = true; } return(guardar); }