Example #1
0
 // DELETE api/values/5
 public void Delete(string id)
 {
     using (DzalekaArtistEntities m = new DzalekaArtistEntities())
     {
         m.Artists.Remove(m.Artists.FirstOrDefault(x => x.ArtistId == id));
         m.SaveChanges();
     }
 }
Example #2
0
        // PUT api/values/5
        public void Put(string id, [FromBody] Artist musician)
        {
            using (DzalekaArtistEntities art = new DzalekaArtistEntities())
            {
                Artist m = art.Artists.FirstOrDefault(e => e.ArtistId == id);

                art.Artists.Add(musician);
                art.SaveChanges();
            }
        }
Example #3
0
 // POST api/values
 public void Post([FromBody] Artist musician)
 {
     using (DzalekaArtistEntities art = new DzalekaArtistEntities())
     {
         //var a = art.Set<music>();
         //a.Add(musician);
         //musician.ID = Guid.NewGuid();
         art.Artists.Add(musician);
         art.SaveChanges();
     }
 }