public async Task <IActionResult> PutFaceShapes(ulong id, [FromBody] FaceShapes faceShapes)
        {
            if (!_authorizationService.ValidateJWTCookie(Request))
            {
                return(Unauthorized(new { errors = new { Token = new string[] { "Invalid token" } }, status = 401 }));
            }

            if (id != faceShapes.Id)
            {
                return(BadRequest(new { errors = new { Id = new string[] { "ID sent does not match the one in the endpoint" } }, status = 400 }));
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutUsers(ulong id, [FromBody] Users users)
        {
            if (!_authorizationService.ValidateJWTCookie(Request))
            {
                return(Unauthorized(new { errors = new { Token = new string[] { "Invalid token" } }, status = 401 }));
            }

            if (id != users.Id)
            {
                return(BadRequest(new { errors = new { Id = new string[] { "ID sent does not match the one in the endpoint" } }, status = 400 }));
            }

            var existingUserName = await _context.Users.AnyAsync(u => u.Id != users.Id && u.UserName == users.UserName);

            if (existingUserName)
            {
                return(Conflict(new { errors = new { UserName = new string[] { "Username is already taken" } }, status = 409 }));
            }

            var existingEmail = await _context.Users.AnyAsync(u => u.Id != users.Id && u.UserEmail == users.UserEmail);

            if (existingEmail)
            {
                return(Conflict(new { errors = new { UserEmail = new string[] { "Email is already registered" } }, status = 409 }));
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutHairStyleLinks(ulong id, [FromBody] HairStyleLinks hairStyleLinks)
        {
            if (!_authorizationService.ValidateJWTCookie(Request))
            {
                return(Unauthorized(new { errors = new { Token = new string[] { "Invalid token" } }, status = 401 }));
            }

            if (id != hairStyleLinks.Id)
            {
                return(BadRequest(new { errors = new { Id = new string[] { "ID sent does not match the one in the endpoint" } }, status = 400 }));
            }

            var correspondingHairStyle = await _context.HairStyles.FirstOrDefaultAsync(h => h.Id == hairStyleLinks.HairStyleId);

            if (correspondingHairStyle == null)
            {
                return(NotFound(new { errors = new { HairStyleId = new string[] { "No matching hair style entry was found" } }, status = 404 }));
            }

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

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

            return(NoContent());
        }