public async Task <IActionResult> PostStageCompetency([FromBody] StageCompetency stageCompetency)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (stageCompetency.Amount <= 0)
            {
                return(BadRequest("Kiekis turi būti didesnis už 0"));
            }

            _context.StageCompetencies.Add(stageCompetency);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStageCompetency", new { id = stageCompetency.StageCompetencyId }, stageCompetency));
        }
        public async Task <IActionResult> PutStageCompetency([FromRoute] int id, [FromBody] StageCompetency stageCompetency)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != stageCompetency.StageCompetencyId)
            {
                return(BadRequest());
            }

            if (stageCompetency.Amount <= 0)
            {
                return(BadRequest("Kiekis turi būti didesnis už 0"));
            }

            _context.Entry(stageCompetency).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StageCompetencyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }