public async Task <IActionResult> Update(int id, [FromBody] PaymentMethod paymentMethod) { // ensure the API call is legit if (paymentMethod == null || paymentMethod.Id != id) { return(HttpBadRequest()); } try { await _service.AssignPaymentMethodIdAsync(paymentMethod); return(new NoContentResult()); } catch (PaymentMethodNotFoundException) { return(HttpNotFound()); } catch (PaymentMethodInvalidException) { return(HttpBadRequest()); } }