public async Task <IActionResult> PutCountryCode([FromRoute] int id, [FromBody] CountryCode countryCode)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != countryCode.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutComment(Comment comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //if (id != Comment.Id)
            //{
            //    return BadRequest();
            //}

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CommentExists(comment.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostReleaseNote(ReleaseNoteParms rnp)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            ReleaseNote releaseNote = new ReleaseNote();

            var rn = await _context.ReleaseNote.Where(x => x.KeyName == rnp.KeyName && x.ReleaseId == rnp.ReleaseId && rnp.CleTypeId == rnp.CleTypeId).Include("CountryCodeReleaseNote").Include("EnvironmentReleaseNote").SingleOrDefaultAsync();

            if (rn == null)
            {
                releaseNote = new ReleaseNote {
                    KeyName = rnp.KeyName, Value = rnp.Value, CleTypeId = rnp.CleTypeId, ReleaseId = rnp.ReleaseId, CommentId = rnp.CommentId
                };
                foreach (int id in rnp.CountryCodeId)
                {
                    releaseNote.CountryCodeReleaseNote.Add(new CountryCodeReleaseNote {
                        CountryCodeId = id
                    });
                }

                foreach (int id in rnp.EnvironmentId)
                {
                    releaseNote.EnvironmentReleaseNote.Add(new EnvironmentReleaseNote {
                        EnvironmentId = id
                    });
                }

                _context.ReleaseNote.Add(releaseNote);
            }

            await _context.SaveChangesAsync();

            return(Ok());
            //   return CreatedAtAction("GetReleaseNote", new { id = rn.Id }, rn);
        }
        public async Task <IActionResult> DeleteReleaseNote([FromRoute] string keyName)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ReleaseNote rDelete = await _context.ReleaseNote.SingleOrDefaultAsync(x => x.KeyName == keyName);


            if (rDelete != null)
            {
                _context.ReleaseNote.Remove(rDelete);
                await _context.SaveChangesAsync();
            }

            return(Ok());
        }