예제 #1
0
        public void Post([FromBody] Participants participants)
        {
            ParticipantsDbEntities entities = new ParticipantsDbEntities();

            entities.Participants.Add(participants);
            entities.SaveChanges();
        }
예제 #2
0
        // GET api/values
        public IHttpActionResult Get()
        {
            ParticipantsDbEntities entities = new ParticipantsDbEntities();
            var result = entities.Participants.ToArray();

            return(Json(result));
        }
예제 #3
0
        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();
        }
예제 #4
0
        // GET api/values/5
        public Participants Get(string initials)
        {
            ParticipantsDbEntities entities = new ParticipantsDbEntities();

            return(entities.Participants.FirstOrDefault(x => x.initials == initials));
        }