public async Task <IActionResult> PutMtnCity([FromRoute] int id, [FromBody] MtnCity mtnCity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mtnCity.CityId) { return(BadRequest()); } _context.Entry(mtnCity).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MtnCityExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMtnCity([FromBody] MtnCity mtnCity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MtnCity.Add(mtnCity); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMtnCity", new { id = mtnCity.CityId }, mtnCity)); }