public IHttpActionResult PutSupplierPayment(int id, SupplierPayment supplierPayment) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != supplierPayment.Id) { return BadRequest(); } db.Entry(supplierPayment).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SupplierPaymentExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSupplierPayment(SupplierPayment supplierPayment) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.SupplierPayments.Add(supplierPayment); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = supplierPayment.Id }, supplierPayment); }