public HttpResponseMessage GetAllGastouders() { using (GastouderAdminDbContext db = new GastouderAdminDbContext()) { return(new HttpResponseMessage() { Content = new StringContent(Newtonsoft.Json.Linq.JArray.FromObject(db.Gastouders.ToList()).ToString(), System.Text.Encoding.UTF8, "application/json") }); } }
public IHttpActionResult GetGastouder(int id) { using (GastouderAdminDbContext db = new GastouderAdminDbContext()) { var gastouder = db.Gastouders.FirstOrDefault((p) => p.Id == id); if (gastouder == null) { return(NotFound()); } return(Ok(gastouder)); } }