Ejemplo n.º 1
0
        public async Task <IActionResult> PutCategorias_Produtos(int id, Categorias_Produtos categorias_Produtos)
        {
            if (id != categorias_Produtos.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Categorias_Produtos> > PostCategorias_Produtos(Categorias_Produtos categorias_Produtos)
        {
            _context.categorias_produtos.Add(categorias_Produtos);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCategorias_Produtos", new { id = categorias_Produtos.Id }, categorias_Produtos));
        }