public async Task <IActionResult> PutElocallyControlledArea(short id, ElocallyControlledArea elocallyControlledArea) { if (id != elocallyControlledArea.ElocallyControlledAreaId) { return(BadRequest()); } _context.Entry(elocallyControlledArea).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ElocallyControlledAreaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ElocallyControlledArea> > PostElocallyControlledArea(ElocallyControlledArea elocallyControlledArea) { _context.ElocallyControlledArea.Add(elocallyControlledArea); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ElocallyControlledAreaExists(elocallyControlledArea.ElocallyControlledAreaId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetElocallyControlledArea", new { id = elocallyControlledArea.ElocallyControlledAreaId }, elocallyControlledArea)); }