MVC Web Api as a mid-range service

In our recent application, we plan to use the MVC Web API as a Middler service. It is clear that the front end will access the mid-level WebAPI service to get all the necessary data from the database and update the data back to the database. Along with this, there may be many other methods that we will need. For example, check if the user exists in the system, confirm the address, etc. Now I have come to the conclusion that my routing of webapiconfig.cs is becoming more and more complicated. For example, my UserController in a WebApi project will have the following methods.

public User Get (int userId) {}

    public bool IsUserExists(string username)
    {
    }

    public bool UpdateUser([FromBody]User user)
    {
    }

    public bool ChangePassword(string username, string password)
    {
    }

webapiconfig.cs. , , . AttributeRouting? . .

+3
1

web api 2, . .

, REST, RPC. CRUD: -

  • - HTTP POST /user

  • - HTTP GET /user /user/{id}

  • - HTTP PUT /user

  • - HTTP DELETE /user/{id}

,

/user/UpdateUser

HTTPPUT to /user/

REST this.

+2

All Articles