public ActionResult <IEnumerable <CustomerReadDto> > CreateCustomers(IEnumerable <CustomerCreateDto> customerCreateDtos) { // TODO: add validations as - at least 1 entity arrived, sex is either 'M' or 'F', etc.. var customers = _mapper.Map <IEnumerable <Customer> >(customerCreateDtos); _customerRepo.CreateCustomers(customers); _customerRepo.SaveChanges(); var customersIds = customers.Select(x => x.Id).ToArray(); var customersFromRepo = _customerRepo.GetCustomersByIds(customersIds); if (customersFromRepo.All(x => x != null)) { return(Ok(_mapper.Map <IEnumerable <CustomerReadDto> >(customersFromRepo))); } return(NotFound()); }