c# - Calling WebApi Controller methods from other classes in the project -


i new webapi (and rusty in c#.net).

so have made controller class , working fine when tested web browser.the controller class receives data , put in database. here definition of method:

// post: api/books     [responsetype(typeof(book))]     public async task<ihttpactionresult> postbook(book book)     {} 

it queries database , returns json object (as usual). looks this:

// get: api/books     public iqueryable<bookdto> getbooks()     {} 

my question whether practice use these methods inside other classes of same project. instance, can separate class call getbooks() method can proceed classifications on them? or can controller call methods controller? practice?

i hope question clear. sorry confusion.

thanks


Comments