コード例 #1
0
        public async Task <ActionResult <CarModelAutoTest> > PostCarModelAutoTest(CarModelAutoTest carModelAutoTest)
        {
            _context.CarModelAutoTest.Add(carModelAutoTest);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCarModelAutoTest", new { id = carModelAutoTest.Id }, carModelAutoTest));
        }
コード例 #2
0
        public async Task <IActionResult> PutCarModelAutoTest(int id, CarModelAutoTest carModelAutoTest)
        {
            if (id != carModelAutoTest.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }