Exemplo n.º 1
0
        public async Task <IActionResult> Put(int id, [FromBody] ENPDetail _ENPDetail)
        {
            if (id != _ENPDetail.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <ENPDetail> > Post([FromBody] ENPDetail _ENPDetail)
        {
            _context.ENPDetail.Add(_ENPDetail);
            await _context.SaveChangesAsync();

            //return CreatedAtAction("GetENPDetail", new { id = _ENPDetail.Id }, _ENPDetail);
            return(CreatedAtAction(nameof(Get), new { id = _ENPDetail.Id }, _ENPDetail));
        }