Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:21:47+00:00 2026-06-09T04:21:47+00:00

The scenario: a User class has several groups of properties: password , address ,

  • 0

The scenario:

a User class has several groups of properties: password, address, preference, roles.

We need different Ajax calls to update the (1) user password, (2) user profile, (3) roles a user is in.

All the tutorials and examples only shows one POST action to update the whole User class. My question is how we can update only part of the class.

For example, when updating the user password, we will:

  1. Display a text box to collect new password from user input.
  2. Make an Ajax call that only POST the new password together with the userId (like: {id=3, newPassword=xxxxx}) to the WebAPI POST action.
  3. That action will only update the password for the user.

One solution: (the easiest to think of)

  1. Call the GET action with the userId to retrieve all the data for a user
  2. Update the password in the user data with the values obtained from the web user input
  3. Call the POST action with the updated data, which contains all properties in the User class.
  4. That POST action will update the whole data without knowing only the password is changed.

The benefit: only one POST action is needed for the ApiController.

The shortcoming: we have to Ajax twice.

So, is it possible that we can have multiple POST actions in one ApiController? For example, PostPassword(userId, password), PostProfile(userId, profile) and PostRoles(userId, roles).

In this way, we will only call PostPassword to send the password to ApiController. In client side, there will be only one Ajax call. It is on the server where we will do the update. The benefit is of course the reduced data transferred over Internet.

If it is possible, what is the correct way to direct all different POST calls to their corresponding actions in the ApiController?

Please help us. Thank you all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:21:48+00:00Added an answer on June 9, 2026 at 4:21 am

    Most of cases, needless to have muptile post actions, I think. The typical case is consumer needs to edit user. So, s/he needs to load user data first to show on the edit form. After editing, consumer can click Save button to submit data and call POST action on api controller.

    If your case is different, you should have nullable property for value type, and then the logic which should be checked in controller is if any property is null, it should not update this property into database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose a scenario like below : Class User {} // User has Admin Role
Scenario: The Invoice has a reference to the class User. A user object is
Here I am explaining the scenario - The user, after providing a service has
I was wondering: Imagine a scenario where e.g. //POJO public class User { private
The scenario - legacy application with 10 year history, has always used procedure calls
Here is scenario. FormA loads. ClassA is instantiated at the form class scope. User
Scenario: User A send application request to user B User B accepts request after
Scenario: User X1 logged in. He can not be logged again. up to previous
This is the standard scenario: User registers on the site User receives an account
I've following scenario: The user loads home.html , selects a subset of the five

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.