public async Task <IActionResult> PutTlocallyControlledArea(short id, TlocallyControlledArea tlocallyControlledArea) { if (id != tlocallyControlledArea.TlocallyControlledAreaId) { return(BadRequest()); } _context.Entry(tlocallyControlledArea).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TlocallyControlledAreaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TlocallyControlledArea> > PostTlocallyControlledArea(TlocallyControlledArea tlocallyControlledArea) { _context.TlocallyControlledArea.Add(tlocallyControlledArea); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TlocallyControlledAreaExists(tlocallyControlledArea.TlocallyControlledAreaId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTlocallyControlledArea", new { id = tlocallyControlledArea.TlocallyControlledAreaId }, tlocallyControlledArea)); }