public static Person MapUserToUserForUpdateDto(Person person, UserForUpdateDtos updatedUser)
        {
            person.City         = updatedUser.City;
            person.Country      = updatedUser.Country;
            person.Interests    = updatedUser.Interests;
            person.Introduction = updatedUser.Introduction;
            person.LookingFor   = updatedUser.LookingFor;

            return(person);
        }
        public async Task <IActionResult> UpdateUser(int id, UserForUpdateDtos userforUpdateDtos)
        {
            if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }
            var userFromRepo = await _repo.GetUser(id);

            _mapper.Map(userforUpdateDtos, userFromRepo);

            if (await _repo.SaveAll())
            {
                return(NoContent());
            }
            throw new Exception($"Updating user {id} failed while saving");
        }
        public async Task <IActionResult> Put(string id, [FromBody] UserForUpdateDtos user)
        {
            // check if the user is authorized
            if (id != User.FindFirst(ClaimTypes.NameIdentifier).Value)
            {
                return(Unauthorized());
            }
            var currentPerson = await _cosmosManager.GetPersonById(id);

            var person   = Helpers.HelperMapper.MapUserToUserForUpdateDto(currentPerson, user);
            var response = await _cosmosManager.UpdatePersonsData(id, person);

            if (response == HttpStatusCode.OK)
            {
                return(NoContent());
            }
            return(BadRequest("Unable to update the person"));
        }