public async Task <ActionResult <TypeStock> > PostTypeStock(TypeStock typeStock) { _context.TypeStocks.Add(typeStock); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTypeStock", new { id = typeStock.Id }, typeStock)); }
public async Task <IActionResult> PutTypeStock(int id, TypeStock typeStock) { if (id != typeStock.Id) { return(BadRequest()); } _context.Entry(typeStock).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeStockExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }