コード例 #1
0
        public async Task <ActionResult <ModelTires> > PostModelTires(ModelTires modelTires)
        {
            _context.ModelTires.Add(modelTires);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetModelTires", new { id = modelTires?.Id }, modelTires));
        }
コード例 #2
0
        public async Task <IActionResult> PutModelTires(int id, ModelTires modelTires)
        {
            if (id != modelTires?.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }