public async Task <IActionResult> PutAsync(int id, [FromBody] SavePaymentResource resource) { var payment = _mapper.Map <SavePaymentResource, Payment>(resource); var result = await _paymentService.UpdateAsync(id, payment); if (!result.Succes) { return(BadRequest(result.Message)); } var paymentResource = _mapper.Map <Payment, PaymentResource>(result.Resource); return(Ok(paymentResource)); }
public async Task <IActionResult> EditPayment(int paymentId, [FromBody] SavePaymentResource resource) { var customer = _mapper.Map <SavePaymentResource, Payment>(resource); var result = await _PaymentService.UpdateAsync(paymentId, customer); if (!result.Success) { return(BadRequest(result.Message)); } var customerResource = _mapper.Map <Payment, PaymentResource>(result.payment); return(Ok(customerResource)); }
public async Task <IActionResult> PostAsync([FromBody] SavePaymentResource resource, int userCommonId) { if (!ModelState.IsValid) { return(BadRequest("Invalid Input")); } var payment = _mapper.Map <SavePaymentResource, Payment>(resource); var result = await _paymentService.SaveAsync(payment, userCommonId); if (!result.Succes) { return(BadRequest(result.Message)); } var paymentResource = _mapper.Map <Payment, PaymentResource>(result.Resource); return(Ok(paymentResource)); }
public async Task <ActionResult> RegisterPaymentByProviderId(int providerId, [FromBody] SavePaymentResource resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var Payment = _mapper.Map <SavePaymentResource, Payment>(resource); var result = await _PaymentService.SaveByServicesProviderIdAsync(providerId, Payment); if (!result.Success) { return(BadRequest(result.Message)); } var PaymentResource = _mapper.Map <Payment, PaymentResource>(result.payment); return(Ok(PaymentResource)); }