Beispiel #1
0
        public async Task <IActionResult> PutGasDensity([FromRoute] int id, [FromBody] GasDensity gasDensity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> PostGasDensity([FromBody] GasDensity gasDensity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.GasDensity.Add(gasDensity);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGasDensity", new { id = gasDensity.Id }, gasDensity));
        }