Exemplo n.º 1
0
        public async Task <IActionResult> PutDeviceType(long id, DeviceType deviceType)
        {
            if (id != deviceType.DeviceTypeId)
            {
                return(BadRequest());
            }

            _context.Entry(deviceType).State = EntityState.Modified;

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutHome(long id, Home home)
        {
            if (id != home.HomeId)
            {
                return(BadRequest());
            }

            myDbContext.Entry(home).State = EntityState.Modified;

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

            return(NoContent());
        }
        public async Task <IActionResult> PutStringParameter(long id, StringParameter stringParameter)
        {
            if (id != stringParameter.StringParameterId)
            {
                return(BadRequest());
            }

            _context.Entry(stringParameter).State = EntityState.Modified;

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

            return(NoContent());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> PutUser(long id, User user)
        {
            if (id != user.UserId)
            {
                return(BadRequest());
            }

            myDbContext.Entry(user).State = EntityState.Modified;

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

            return(NoContent());
        }