Exemple #1
0
        public async Task <IActionResult> PutCities(int id, Cities cities)
        {
            if (id != cities.Id)
            {
                return(BadRequest());
            }

            _context.Entry(cities).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CitiesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PutCountries(int id, Countries countries)

        {
            System.Diagnostics.Debug.WriteLine(countries.Id);
            System.Diagnostics.Debug.WriteLine(countries);
            System.Diagnostics.Debug.WriteLine(id);
            if (id != countries.Id)
            {
                System.Diagnostics.Debug.WriteLine(countries.Id);

                return(BadRequest());
            }

            _context.Entry(countries).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CountriesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }