public async Task <IHttpActionResult> PutNomDevice(int id, NomDevice nomDevice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != nomDevice.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NomDeviceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GetNomDevice(int id)
        {
            NomDevice nomDevice = await db.NomDevices.FindAsync(id);

            if (nomDevice == null)
            {
                return(NotFound());
            }

            return(Ok(nomDevice));
        }
        public async Task <IHttpActionResult> PostNomDevice(NomDevice nomDevice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NomDevices.Add(nomDevice);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = nomDevice.Id }, nomDevice));
        }
        public async Task <IHttpActionResult> DeleteNomDevice(int id)
        {
            NomDevice nomDevice = await db.NomDevices.FindAsync(id);

            if (nomDevice == null)
            {
                return(NotFound());
            }

            db.NomDevices.Remove(nomDevice);
            await db.SaveChangesAsync();

            return(Ok(nomDevice));
        }