Beispiel #1
0
 // GET: api/Doc/5
 public persone1 Get(int id)
 {
     using (tesEntities entity = new tesEntities())
     {
         return(entity.persone1.Where(x => x.id == id).FirstOrDefault());
     }
 }
Beispiel #2
0
 // GET: api/Doc
 public IEnumerable <persone1> Get()
 {
     using (tesEntities entity = new tesEntities())
     {
         return(entity.persone1.ToList());
     }
 }
Beispiel #3
0
 // DELETE: api/Doc/5
 public void Delete(int id)
 {
     using (tesEntities entity = new tesEntities())
     {
         entity.persone1.Remove(this.Get(id));
         entity.SaveChanges();
     }
 }
Beispiel #4
0
 // POST: api/Doc
 public void Post([FromBody] persone1 value)
 {
     using (tesEntities entity = new tesEntities())
     {
         entity.persone1.Add(value);
         entity.SaveChanges();
     }
 }
Beispiel #5
0
 // change a personel name
 // PUT: api/Doc/5
 public void Put(int id, [FromBody] string value)
 {
     using (tesEntities entity = new tesEntities())
     {
         var val = entity.persone1.Single(x => x.id == id);
         val.name = value;
         entity.SaveChanges();
     }
 }