Exemple #1
0
        public async Task <IActionResult> PutWellDummy([FromRoute] int id, [FromBody] WellDummy wellDummy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PostWellDummy([FromBody] WellDummy wellDummy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.wellDummies.Add(wellDummy);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWellDummy", new { id = wellDummy.id }, wellDummy));
        }