// DELETE api/agenda/5 public void Delete(int id) { Models.AgendaDataContext dc = new Models.AgendaDataContext(); Models.Compromisso comp = (from f in dc.Compromissos where f.Id == id select f).Single(); dc.Compromissos.DeleteOnSubmit(comp); dc.SubmitChanges(); }
// PUT api/agenda/5 public void Put(int id, [FromBody] string value) { Models.Compromisso x = JsonConvert.DeserializeObject <Models.Compromisso>(value); Models.AgendaDataContext dc = new Models.AgendaDataContext(); Models.Compromisso comp = (from f in dc.Compromissos where f.Id == id select f).Single(); comp.Descricao = x.Descricao; comp.Local = x.Local; comp.Data = x.Data; comp.Realizado = x.Realizado; dc.SubmitChanges(); }