public async Task <IActionResult> PutPaymentMethod(int id, PublicApi.v1.DTO.PaymentMethod paymentMethod) { if (id != paymentMethod.Id) { return(BadRequest()); } _bll.PaymentMethods.Update(PublicApi.v1.Mappers.PaymentMethodMapper.MapFromExternal(paymentMethod)); await _bll.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <PublicApi.v1.DTO.PaymentMethod> > PostPaymentMethod( PublicApi.v1.DTO.PaymentMethod paymentMethod) { paymentMethod = PublicApi.v1.Mappers.PaymentMethodMapper.MapFromInternal( _bll.PaymentMethods.Add(PublicApi.v1.Mappers.PaymentMethodMapper.MapFromExternal(paymentMethod))); await _bll.SaveChangesAsync(); paymentMethod = PublicApi.v1.Mappers.PaymentMethodMapper.MapFromInternal( _bll.PaymentMethods.GetUpdatesAfterUOWSaveChanges( PublicApi.v1.Mappers.PaymentMethodMapper.MapFromExternal(paymentMethod))); return(CreatedAtAction("GetPaymentMethod", new { version = HttpContext.GetRequestedApiVersion().ToString(), id = paymentMethod.Id }, paymentMethod)); }