Exemple #1
0
        public async Task <IActionResult> PutDbUser(int id, DbUser dbUser)
        {
            if (id != dbUser.DbUserId)
            {
                return(BadRequest());
            }

            AdapterContext.Entry(dbUser).State = EntityState.Modified;

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PutAdapterType(int id, AdapterType adapterType)
        {
            if (id != adapterType.AdapterTypeId)
            {
                return(BadRequest());
            }

            AdapterContext.Entry(adapterType).State = EntityState.Modified;

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

            return(NoContent());
        }