コード例 #1
0
        public ActionResult <ItemResponse <int> > Update(UserProfileUpdateRequest model)
        {
            _service.Update(model);
            SuccessResponse response = new SuccessResponse();

            return(Ok(response));
        }
コード例 #2
0
        public void Update(UserProfileUpdateRequest model)
        {
            string procName = "[dbo].[UserProfiles_Update]";

            _data.ExecuteNonQuery(procName, delegate(SqlParameterCollection col)
            {
                CommonParams(model, col);
                col.AddWithValue("@Id", model.Id);
            }, returnParameters: null);
        }
コード例 #3
0
 public void Update(UserProfileUpdateRequest model)
 {
     this._dataProvider.ExecuteNonQuery("dbo.UserProfiles_Update",
                                        inputParamMapper : delegate(SqlParameterCollection paramCol)
     {
         PopulatesParamCol(model, paramCol);
         paramCol.AddWithValue("@Id", model.Id);
     }
                                        );
 }
コード例 #4
0
        public void Update(UserProfileUpdateRequest model)
        {
            string procName = "[dbo].[UserProfiles_Update_V2]";

            _data.ExecuteNonQuery(procName, inputParamMapper : delegate(SqlParameterCollection paramCol)
            {
                AddCommonParameters(model, paramCol);

                paramCol.AddWithValue("@Id", model.Id);
            }, returnParameters: null);
        }
コード例 #5
0
        public void Update(UserProfileUpdateRequest model)
        {
            string procName = "[dbo].[UserProfile_Update_V2]";

            _data.ExecuteNonQuery(procName, inputParamMapper : delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@GivenName", model.GivenName);
                col.AddWithValue("@Surnames", model.Surnames);
                col.AddWithValue("@AvatarUrl", model.AvatarUrl);
                col.AddWithValue("@Url", model.Url);
                col.AddWithValue("@ProfileId", model.Id);
            });
        }
コード例 #6
0
        public void Put(UserProfileUpdateRequest model)
        {
            DataProvider.ExecuteNonQuery(GetConnection, "dbo.UserProfile_updateInformation"
                                         , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@firstName", model.firstName);
                paramCollection.AddWithValue("@lastName", model.lastName);
                paramCollection.AddWithValue("@profileContent", model.profileContent);
                paramCollection.AddWithValue("@tagLine", model.tagLine);
                paramCollection.AddWithValue("@userId", model.id);
            }

                                         );
        }
コード例 #7
0
        public async Task <IActionResult> UpdateUserProfile([FromBody] UserProfileUpdateRequest request)
        {
            var userId = GetUserId();

            var user = _mapper.Map <User>(request);

            var result = await _usersManager.UpdateUserProfile(user, userId);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result.Entity));
        }
コード例 #8
0
 //PUT NEW USER
 public void Put(UserProfileUpdateRequest model)
 {
     DataProvider.ExecuteNonQuery("dbo.Users_UserProfile_Update",
                                  inputParamMapper : delegate(SqlParameterCollection paramCollection)
     {
         paramCollection.AddWithValue("@FirstName", model.FirstName);
         paramCollection.AddWithValue("@MiddleName", model.MiddleName);
         paramCollection.AddWithValue("@LastName", model.LastName);
         paramCollection.AddWithValue("@DateOfBirth", model.DateOfBirth);
         paramCollection.AddWithValue("@Gender", model.Gender);
         paramCollection.AddWithValue("@AvatarUrl", model.AvatarUrl);
         paramCollection.AddWithValue("@BgImageUrl", model.BgImageUrl);
         paramCollection.AddWithValue("@Bio", model.Bio);
         paramCollection.AddWithValue("@Id", model.Id);
     });
 }
コード例 #9
0
        public ActionResult <SuccessResponse> Update(UserProfileUpdateRequest model)
        {
            ActionResult result = null;

            try
            {
                _userProfile.Update(model);
                SuccessResponse response = new SuccessResponse();
                result = Ok200(response);
            }
            catch (Exception e)
            {
                Logger.LogError(e.ToString());
                result = StatusCode(500, new ErrorResponse(e.Message));
            }
            return(result);
        }
コード例 #10
0
 public void Update(UserProfileUpdateRequest model)
 {
     _dataProvider.ExecuteNonQuery("dbo.UserProfiles_Update", inputParamMapper : delegate(SqlParameterCollection parms)
     {
         parms.AddWithValue("@Id", model.Id);
         parms.AddWithValue("@Bio", model.Bio ?? SqlString.Null);;
         parms.AddWithValue("@AvatarUrl", model.AvatarUrl ?? SqlString.Null);
         parms.AddWithValue("@Phone", model.Phone);
         parms.AddWithValue("@RaceEthnicityId", model.RaceEthnicityId ?? SqlInt32.Null);
         parms.AddWithValue("@EducationLevelId", model.EducationLevelId ?? SqlInt32.Null);
         parms.AddWithValue("@HouseIncome", model.HouseIncome);
         parms.AddWithValue("@YearsInBusiness", model.YearsInBusiness ?? SqlInt32.Null);
         parms.AddWithValue("@FirstName", model.FirstName);
         parms.AddWithValue("@Lastname", model.LastName);
         parms.AddWithValue("@Zip", model.Zip);
     });
 }
コード例 #11
0
        public ActionResult <ItemResponse <int> > Update(UserProfileUpdateRequest model)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                _service.Update(model);
                response = new SuccessResponse();
            }
            catch (Exception ex)
            {
                code     = 400;
                response = new ErrorResponse(ex.Message);
                base.Logger.LogError(ex.ToString());
            }
            return(StatusCode(code, response));
        }
コード例 #12
0
        public async Task <IActionResult> UpdateUserProfile([FromForm] UserProfileUpdateRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(400));
            }

            var dto = _mapper.Map <UserProfileUpdateDTO>(request);

            dto.ModifiedUtc = DateTime.Now;

            if (await _manager.UpdateUserProfile(dto))
            {
                return(StatusCode(202));
            }

            throw new Exception("User Profile could not be updated.");
        }
コード例 #13
0
        public HttpResponseMessage updateToForm(UserProfileUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
            else
            {
                model.id = UserService.GetCurrentUserId();

                _userProfileService.Put(model);

                ItemResponse <bool> response = new ItemResponse <bool>();

                response.IsSuccessful = true;

                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
        }
コード例 #14
0
 public ActionResult <SuccessResponse> Update(int id, UserProfileUpdateRequest model)
 {
     try
     {
         if (id == model.Id)
         {
             _profileService.Update(model);
             SuccessResponse resp = new SuccessResponse();
             return(Ok200(resp));
         }
         else
         {
             return(NotFound404(new ErrorResponse("Bad Request: Body Id does not match url")));
         }
     }
     catch (Exception ex)
     {
         Logger.LogError(ex.ToString());
         return(StatusCode(500, new ErrorResponse(ex.Message)));
     }
 }
コード例 #15
0
        public async Task ShouldUpdateProfile()
        {
            // Arrange
            var profile = await _client.Profile.GetAsync().ConfigureAwait(false);

            // Act
            var updateRequest = new UserProfileUpdateRequest
            {
                Id           = profile.Id,
                Address      = profile.Address,
                EmailAddress = profile.EmailAddress,
                FirstName    = profile.FirstName + "1",
                LanguageCode = profile.LanguageCode,
                LastName     = profile.LastName
            };

            var updatedProfile = await _client.Profile.UpdateAsync(updateRequest).ConfigureAwait(false);

            // Assert
            updatedProfile.FirstName.Should().Be(profile.FirstName + "1");
        }
コード例 #16
0
 public void Update(UserProfileUpdateRequest model)
 {
     _dataProvider.ExecuteNonQuery(
         "dbo.UserProfiles_Update",
         (parameters) =>
     {
         parameters.AddWithValue("@Id", model.Id);
         parameters.AddWithValue("@FirstName", model.FirstName);
         parameters.AddWithValue("@LastName", model.LastName);
         if (model.AvatarUrl == null || model.AvatarUrl.ToString() == "")
         {
             parameters.AddWithValue("@AvatarUrl", "");
         }
         else
         {
             parameters.AddWithValue("@AvatarUrl", model.AvatarUrl.ToString());
         }
         parameters.AddWithValue("@Description", model.Description);
         parameters.AddWithValue("@DOB", model.DOB);
         parameters.AddWithValue("@PhoneNumber", model.PhoneNumber);
         parameters.AddWithValue("@MilestoneId", model.MilestoneId);
     }
         );
 }