// GET: api/ControladorPrincipal public IEnumerable <Persona_Jorge> Get() { using (practicantesEntities1 db = new practicantesEntities1()) { return(db.Persona_Jorge.ToList()); } }
// POST: api/ControladorPrincipal public HttpResponseMessage Post([FromBody]Persona_Jorge Insertar) { int resp = 0; HttpResponseMessage msj = null; try { using (practicantesEntities1 entities = new practicantesEntities1()) { entities.Entry(Insertar).State = System.Data.Entity.EntityState.Added; resp = entities.SaveChanges(); msj = Request.CreateResponse(HttpStatusCode.OK, resp); } } catch (Exception exe) { msj = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exe.Message); } return msj; }