public async Task <IActionResult> PutContent(int id, Content content)
        {
            if (id != content.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <Field> > PutField(int id, Field field)
        {
            if (id != field.ID)
            {
                return(BadRequest());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (_context.Fields.Any(x => x.ID == id))
                {
                    throw;
                }

                return(NotFound());
            }

            return(field);
        }
Beispiel #3
0
        public async Task <ActionResult <ContentType> > PutContentType(int id, ContentType contentType)
        {
            if (id != contentType.ID)
            {
                return(BadRequest());
            }

            _db.Entry(contentType).State = EntityState.Modified;

            try
            {
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (_db.ContentTypes.Any(e => e.ID == id))
                {
                    throw;
                }

                return(NotFound());
            }

            return(contentType);
        }