Esempio n. 1
0
        public async Task <ActionResult <TblCities> > PostTblCities(TblCities tblCities)
        {
            _context.TblCities.Add(tblCities);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTblCities", new { id = tblCities.CityId }, tblCities));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutTblCities(int id, TblCities tblCities)
        {
            if (id != tblCities.CityId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }