// 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(); } }
// 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(); } }
// 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(); } }