Beispiel #1
0
 // GET: api/ControladorPrincipal
 public IEnumerable <Persona_Jorge> Get()
 {
     using (practicantesEntities1 db = new practicantesEntities1())
     {
         return(db.Persona_Jorge.ToList());
     }
 }
Beispiel #2
0
 // 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;
 }