public IHttpActionResult GetTrainingsAttendee(int id) { TrainingsAttendee trainingsAttendee = db.TrainingsAttendees.Find(id); if (trainingsAttendee == null) { return(NotFound()); } return(Ok(trainingsAttendee)); }
public IHttpActionResult PostTrainingsAttendee(TrainingsAttendee trainingsAttendee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TrainingsAttendees.Add(trainingsAttendee); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = trainingsAttendee.Id }, trainingsAttendee)); }