public async Task <IActionResult> Edit(int Id, CustomerCountriesDto customerCountriesDto)
        {
            if (Id != customerCountriesDto.IdCustomerCountry)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var CustomerCountries = _mapper.Map <CustomerCountriesDto, CustomerCountries>(customerCountriesDto);
                    var country           = _context.CustomerCountries.FirstOrDefault(c => c.IdCustomerCountry == CustomerCountries.IdCustomerCountry);
                    country.CustomerCountryName = customerCountriesDto.CustomerCountryName;
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerCountriesExists(customerCountriesDto.IdCustomerCountry))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customerCountriesDto));
        }
        public async Task <IActionResult> DeleteConfirmed(int id, CustomerCountriesDto customerCountriesDto)
        {
            var CustomerCountries = _mapper.Map <CustomerCountriesDto, CustomerCountries>(customerCountriesDto);
            var customerCountries = await _context.CustomerCountries.FindAsync(id);

            _context.CustomerCountries.Remove(customerCountries);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Create(CustomerCountriesDto customerCountriesDto)
        {
            if (ModelState.IsValid)
            {
                var customer = _mapper.Map <CustomerCountriesDto, CustomerCountries>(customerCountriesDto);
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View());
        }