public async Task <ActionResult <IngrType> > PostIngrType(IngrType ingrType) { _context.IngrTypes.Add(ingrType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetIngrType", new { id = ingrType.Id }, ingrType)); }
public async Task <IActionResult> PutIngrType(int id, IngrType ingrType) { if (id != ingrType.Id) { return(BadRequest()); } _context.Entry(ingrType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IngrTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }