public async Task <ActionResult> UpdateCustomerInfo([FromRoute] int id, [FromBody] CustomerInfoVM vm) { if (!ModelState.IsValid) { return(BadRequest()); } try { await _registrationsService.UpdateCustomerInfo( id, vm.CustomerName, vm.CustomerEmail, vm.CustomerVatNumber, vm.CustomerInvoiceReference); await _registrationsService.UpdateCustomerAddress( id, vm.CustomerAddress, vm.CustomerCity, vm.CustomerZip, vm.CustomerCountry); } catch (ArgumentException) { return(BadRequest()); } return(Ok()); }
private CustomerInfoVM MapTo(CustomerInfo info) { if (info != null) { var customerVm = new CustomerInfoVM { CustomerName = info.CustomerName, CustomerCode = info.CustomerCode, IndustryId = info.IndustryId, CustomerLevel = info.CustomerLevel, CustomerTypeId = info.CustomerTypeId, CreateDate = info.CreateDate, }; return(customerVm); } return(null); }