public async Task <ActionResult <PurchasingPower> > PostPurchasingPower(PurchasingPower purchasingPower) { _context.PurchasingPower.Add(purchasingPower); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPurchasingPower", new { id = purchasingPower.Id }, purchasingPower)); }
public async Task <IActionResult> PutPurchasingPower(int id, PurchasingPower purchasingPower) { if (id != purchasingPower.Id) { return(BadRequest()); } _context.Entry(purchasingPower).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PurchasingPowerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }