public async Task <IActionResult> PutTcrossSection(short id, TcrossSection tcrossSection) { if (id != tcrossSection.TcrossSectionId) { return(BadRequest()); } _context.Entry(tcrossSection).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TcrossSectionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TcrossSection> > PostTcrossSection(TcrossSection tcrossSection) { _context.TcrossSection.Add(tcrossSection); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TcrossSectionExists(tcrossSection.TcrossSectionId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTcrossSection", new { id = tcrossSection.TcrossSectionId }, tcrossSection)); }