コード例 #1
0
ファイル: UserService.cs プロジェクト: dev-ips/Lifvs-Server
        public bool ChangeProfile(long userId, UserProfileViewModel model)
        {
            //_userProfileViewValidators.Validate(model);

            model.Id = userId;
            var isDuplicateEmail = _accessTokenRepository.CheckDuplicateEmail(model.Id, model.Email);

            if (isDuplicateEmail == true)
            {
                throw _exception.ThrowException(System.Net.HttpStatusCode.BadRequest, "", "Emailadressen är redan registrerad med en annan person.");
            }


            var user = _accessTokenRepository.GetUser(model.Id);

            //user.Email = model.Email;
            user.AreaAddress   = model.AreaAddress;
            user.StreetAddress = model.StreetAddress;
            user.PostalAddress = model.PostalAddress;
            user.CountryId     = model.CountryId;

            return(_userRepository.ChangeUserProfile(user));
        }