Exemple #1
0
        public async Task <IHttpActionResult> PutDeviceSpecificConstants(int id, DeviceSpecificConstants deviceSpecificConstants)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
        public async Task <IHttpActionResult> GetDeviceSpecificConstants(int id)
        {
            DeviceSpecificConstants deviceSpecificConstants = await db.DeviceSpecificConstants.FindAsync(id);

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

            return(Ok(deviceSpecificConstants));
        }
Exemple #3
0
        public async Task <IHttpActionResult> PostDeviceSpecificConstants(DeviceSpecificConstants deviceSpecificConstants)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DeviceSpecificConstants.Add(deviceSpecificConstants);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = deviceSpecificConstants.Id }, deviceSpecificConstants));
        }
Exemple #4
0
        public async Task <IHttpActionResult> DeleteDeviceSpecificConstants(int id)
        {
            DeviceSpecificConstants deviceSpecificConstants = await db.DeviceSpecificConstants.FindAsync(id);

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

            db.DeviceSpecificConstants.Remove(deviceSpecificConstants);
            await db.SaveChangesAsync();

            return(Ok(deviceSpecificConstants));
        }