public async Task <IActionResult> PostContestCertificate([FromBody] ContestCertificate contestCertificate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            _context.ContestCertificates.Add(contestCertificate);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetContestCertificate", new { id = contestCertificate.ContestCertificateId }, contestCertificate));
        }
        public async Task <IActionResult> PutContestCertificate([FromRoute] int id, [FromBody] ContestCertificate contestCertificate)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != contestCertificate.ContestCertificateId)
            {
                return(BadRequest());
            }

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

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

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

            return(NoContent());
        }