示例#1
0
        public async Task UpdateNames(Guid userId, UpdateUserNamesDto dto)
        {
            var model = await _userProfileRepository.Get(userId);

            model.UpdateNames(dto.NickName, dto.FirstName, dto.LastName);
            await _userProfileRepository.Update(model);
        }
示例#2
0
        public async Task <string> UpdateNames(Guid userId, UserViewModel model)
        {
            if (string.IsNullOrEmpty(model.NickName))
            {
                return("Nickname can not be empty!");
            }

            if (model.NickName != "-")
            {
                //check if nickname exist
                _apiClient.SetPrincipal(_httpContextAccessor.HttpContext.User);
                var user = await _apiClient.GetUserByNickName(model.NickName);

                if (user != null && user.Id != userId)
                {
                    return("NickName alrleady exist");
                }
            }
            var dto = new UpdateUserNamesDto
            {
                NickName  = model.NickName,
                FirstName = model.FirstName,
                LastName  = model.LastName
            };
            await _apiClient.UpdateUserNames(userId, dto);

            return(string.Empty);
        }
示例#3
0
 public async Task UpdateUserNames(Guid userId, UpdateUserNamesDto dto)
 {
     await Patch($"{ProfileUrlPrefix}/{userId}/names", dto);
 }
        public async Task <IActionResult> UpdateNames(Guid userId, [FromBody] UpdateUserNamesDto dto)
        {
            await _profileService.UpdateNames(userId, dto);

            return(Ok());
        }