Пример #1
0
        public async Task <IActionResult> PutPerson([FromRoute] int id, [FromBody] Person person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PostSchemaObject([FromBody] SDSchemaObject schemaObject)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.SDDataTables.AddRange(schemaObject.SDDataTables);
            _context.SDColumns.AddRange(schemaObject.SDColumns);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDbSchema", schemaObject));
        }