public async Task <ActionResult <Customer> > AddCustomer(CustomerAddDTO customer) { try { return(new OkObjectResult(await _woodshopService.AddCustomer(customer))); } catch (Exception ex) { return(new StatusCodeResult(500)); } }
public async Task <Customer> AddCustomer(CustomerAddDTO customer) { try { Customer newCustomer = await _customerRepository.CreateCustomerIfNotExists(_mapper.Map <Customer>(customer)); return(newCustomer); // Person newPerson = _mapper.Map<Person>(customer); // newPerson = await _personRepository.AddPerson(newPerson); // Customer newCustomer = _mapper.Map<Customer>(customer); // await _customerRepository.AddCustomer(newCustomer); // return customer; } catch (Exception ex) { throw ex; } }