public async Task <IActionResult> UpdateRegistry(int id, [FromBody] Models.Registry registry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values));
            }

            var exists = await ExistsAsync(registry.RegistryId);

            if (!exists)
            {
                return(NotFound());
            }

            if (id != registry.RegistryId)
            {
                return(BadRequest(ErrorMessageContracts.MismatchedId));
            }

            try
            {
                _context.Entry(registry).State = EntityState.Modified;
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostNewRegistry([FromBody] Models.Registry registry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values));
            }

            var exists = await ExistsAsync(registry.RegistryId);

            if (exists)
            {
                return(BadRequest(ErrorMessageContracts.IdConflict));
            }

            try
            {
                await _context.AddAsync(registry);

                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }

            return(CreatedAtAction(nameof(PostNewRegistry), registry.RegistryId));
        }