コード例 #1
0
        public async Task <ActionResult <tipoOferta> > PosttipoOferta(tipoOferta tipoOferta)
        {
            _context.tipoOfertas.Add(tipoOferta);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GettipoOferta", new { id = tipoOferta.TipoOfertaId }, tipoOferta));
        }
コード例 #2
0
        public async Task <IActionResult> PuttipoOferta(int id, tipoOferta tipoOferta)
        {
            if (id != tipoOferta.TipoOfertaId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }