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()); }
public async Task <ActionResult <Countries> > PostCountry(Countries countries) { _context.Countries.Add(countries); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetCountry), new { id = countries.Id }, countries)); }