// PUT api/DeviceType/5
        public HttpResponseMessage PutDeviceType(int id, DeviceType devicetype)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != devicetype.DeviceTypeId)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(devicetype).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
        // POST api/DeviceType
        public HttpResponseMessage PostDeviceType(DeviceType devicetype)
        {
            if (ModelState.IsValid)
            {
                db.DeviceTypes.Add(devicetype);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, devicetype);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = devicetype.DeviceTypeId }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }