public HttpResponseMessage UpdateUserInfo(UserUpdateRequest model) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } string userId = _userService.GetCurrentUserId(); SuccessResponse response = new SuccessResponse(); _userService.Update(model, userId); return Request.CreateResponse(response); }
public void Update(UserUpdateRequest model, string userId) { int uid = 0; DataProvider.ExecuteNonQuery(GetConnection, "dbo.Users_Update_v2" , inputParamMapper: delegate (SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@FirstName", model.FirstName); paramCollection.AddWithValue("@LastName", model.LastName); paramCollection.AddWithValue("@Email", model.Email); paramCollection.AddWithValue("@Phone", model.Phone); //paramCollection.AddWithValue("@Zip", model.Zip); paramCollection.AddWithValue("@Gender", model.Gender); paramCollection.AddWithValue("@Age", model.Age); //paramCollection.AddWithValue("@HasKids", model.HasKids); //paramCollection.AddWithValue("@CollegeStudent", model.CollegeStudent); paramCollection.AddWithValue("@MaritalStatus", model.MaritalStatus); //paramCollection.AddWithValue("@SharesFinances", model.SharesFinances); //paramCollection.AddWithValue("@EmploymentStatus", model.EmploymentStatus); paramCollection.AddWithValue("@Income", model.Income); //paramCollection.AddWithValue("@Expenses", model.Expenses); //paramCollection.AddWithValue("@CreditCardDebt", model.CreditCardDebt); //paramCollection.AddWithValue("@StudentLoanDebt", model.StudentLoanDebt); //paramCollection.AddWithValue("@Savings", model.Savings); //paramCollection.AddWithValue("@HomeStatus", model.HomeStatus); //paramCollection.AddWithValue("@FinancialConcern", model.FinancialConcern); paramCollection.AddWithValue("@UserId", userId); paramCollection.AddWithValue("@Id", model.Id); } , returnParameters: delegate (SqlParameterCollection param) { int.TryParse(param["@Id"].Value.ToString(), out uid); } ); }