I have two web api controllers: PageController
and BlogController
. They contain simple crud for creating pages and blogs. Every time I create a blog, I need to create a page, but not vice versa. Whats the best way of doing this? I feel like something weird must happen with my routing if I inherit from PageController
in BlogController
. Is there some way to call the CreatePage
method in PageController
from BlogController
's CreateBlog
method? Should I simply resign myself to making two separate ajax calls every time I want to create a blog?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- Using :remote => true with hover event
- How to store image outside of the website's ro
- Is there a way to play audio on a mobile browser w
- 'System.Threading.ThreadAbortException' in
Try to create object of the controller and then use the respective functions.
If you are going to need to have some common logic that needs to be accessed by multiple controllers you should create a separate class to handle that common logic in a centralized manner.
This class can be part of your web project or in a separate project/assembly.
Basically what you are trying to do is this:
And I am suggesting that you do this: