public async Task <ActionResult <PizzaFact> > PostPizzaFact(PizzaFact pizzaFact) { _context.PizzaFacts.Add(pizzaFact); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPizzaFact", new { id = pizzaFact.PizzaId }, pizzaFact)); }
public async Task <IActionResult> PutPizzaFact(int id, PizzaFact pizzaFact) { if (id != pizzaFact.PizzaId) { return(BadRequest()); } _context.Entry(pizzaFact).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PizzaFactExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }