public async Task <IActionResult> PutMtcHomezone([FromRoute] int id, [FromBody] MtcHomezone mtcHomezone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mtcHomezone.IdHz) { return(BadRequest()); } _context.Entry(mtcHomezone).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MtcHomezoneExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMtcHomezone([FromBody] MtcHomezone mtcHomezone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MtcHomezones.Add(mtcHomezone); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMtcHomezone", new { id = mtcHomezone.IdHz }, mtcHomezone)); }