Beispiel #1
0
        public async Task <IActionResult> AddCustomerCollection([FromBody] IEnumerable <CustomerForCreationDto> modelCollection)
        {
            var customers      = _mapper.Map <IReadOnlyList <Customer> >(modelCollection);
            var customersAdded = _mapper.Map <IReadOnlyList <CustomerDto> >(await _customerService.AddRangeAsync(customers));
            var idsAsString    = string.Join(",", customersAdded.Select(c => c.CustomerID));

            //return Ok(customersAdded);
            return(CreatedAtRoute("GetCustomerCollection",
                                  new { ids = idsAsString },
                                  customersAdded));
        }