public async Task <IActionResult> PutSuppliersData(double id, SuppliersData suppliersData) { if (id != suppliersData.SupplierId) { return(BadRequest()); } _context.Entry(suppliersData).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SuppliersDataExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <SuppliersData> > PostSuppliersData(SuppliersData suppliersData) { _context.SuppliersData.Add(suppliersData); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (SuppliersDataExists(suppliersData.SupplierId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetSuppliersData", new { id = suppliersData.SupplierId }, suppliersData)); }