public async Task <IActionResult> PutCategoria([FromRoute] int id, [FromBody] Categoria categoria) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != categoria.IdCategoria) { return(BadRequest()); } _context.Entry(categoria).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task<IActionResult> Create([Bind("Id,Nome")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } return View(department); }
public async Task InsertAsync(Seller seller) { _context.Seller.Add(seller); await _context.SaveChangesAsync(); }