Esempio n. 1
0
        public async Task <ActionResult <CustomerDto> > CreateCustomer([FromBody] CustomerForCreateDto customer)
        {
            _orm.OpenConn();
            var customerFromDB = _mapper.Map <Customer>(customer);

            var createdCustomer = await _orm.CreateCustomer(customerFromDB);

            var customerDto = _mapper.Map <CustomerDto>(createdCustomer);
            await _orm.CloseConn();

            return(CreatedAtRoute("GetCustomersByID", new { id = customerDto.Id }, customerDto));
        }