public HttpResponseMessage Get()
 {
     using (var widgetsContext = new DemoDataContext())
         {
             return Request.CreateResponse(HttpStatusCode.OK, widgetsContext.Widgets.ToList());
         }
 }
 public IHttpActionResult Post([FromBody] Widget widget)
 {
     using (var widgetsContext = new DemoDataContext())
         {
             widgetsContext.Widgets.Add(widget);
             widgetsContext.SaveChanges();
             return Ok(widget);
         }
 }
 public Widget Put(int widgetId, [FromBody] Widget widget)
 {
     using (var widgetsContext = new DemoDataContext())
         {
             widgetsContext.Widgets.Attach(widget);
             widgetsContext.Entry(widget).State = EntityState.Modified;
             widgetsContext.SaveChanges();
             return widget;
         }
 }