public void Post([FromBody] Participants participants) { ParticipantsDbEntities entities = new ParticipantsDbEntities(); entities.Participants.Add(participants); entities.SaveChanges(); }
// GET api/values public IHttpActionResult Get() { ParticipantsDbEntities entities = new ParticipantsDbEntities(); var result = entities.Participants.ToArray(); return(Json(result)); }
public void Delete(string initials) { ParticipantsDbEntities entities = new ParticipantsDbEntities(); //Participants participant = new Participants(); var p = entities.Participants.Where(x => x.initials == initials).FirstOrDefault(); entities.Participants.Remove(p); entities.SaveChanges(); }
// GET api/values/5 public Participants Get(string initials) { ParticipantsDbEntities entities = new ParticipantsDbEntities(); return(entities.Participants.FirstOrDefault(x => x.initials == initials)); }