Linked Questions
17 questions linked to/from How to call another controller Action From a controller in Mvc
0 votes
1 answer
2k views
ASP.NET MVC: Call method in another namespace / area [duplicate]
I have this simple class inside my ASP.NET MVC 3 application: namespace My.Project.Controllers { public ActionResult Settings() { var m = GetUserData(userID); ... } ...
18 votes
3 answers
155k views
How to call MVC Action using Jquery AJAX and then submit form in MVC?
On my MVC View I have button: <input id="btnSave" type="submit" name="Save" value="Save" /> When I click this button I need call one Action, do some stuff there and then Submit my form. I have ...
4 votes
4 answers
14k views
How to Call Api Controller from another Api Controller In Same Project
i have an object "ApplicantDetail" with list of objects in ApplicantController and i want to send Post Request to Personaldetails Api On To save into database and get response back Api On ...
1 vote
3 answers
7k views
call razor page from mvc controller
I want to reuse my razor pages instead of having multiple similar views in mvc, I don't want to use a partial view. Thus I want to pass a parameter from a controller to razor page. In the razor page ...
3 votes
1 answer
4k views
want to call controller method from class and get controller context without making request to controller?
I want to call a controller method from a class and get the controller context without making requests to the controller. What are possible ways of doing that? I can call method by creating an object ...
0 votes
1 answer
4k views
ASP.NET | Call another controller's action from a controller in MVC
I am thinking about a scenario rather similar to this question asked some time ago: How to call another controller Action From a controller in Mvc In the scenario I am thinking of, controller B would ...
1 vote
1 answer
2k views
calling action method from another action
I have a put method in controller A where i pass in json object and do some checks in dynamo db, based on my output [HttpPut] public async Task<IActionResult> ProcessEmployee([FromBody]...
2 votes
0 answers
2k views
Transfer to another Action (possibly same or different Controller) without HTTP Redirect in ASP.NET Core?
I can't believe I cannot find any solution to this. For business reason, RedirectToAction or anything won't do because it causes a HTTP 302 to be returned. An example: public async Task<...
2 votes
1 answer
1k views
How to call parameterized constructor controller action in another controller?
I am having two controller. 1st controller having parameterized constructor and some methods. Now I have to call that methods in my another controller. is there any way to do it? Below is code ...
-1 votes
1 answer
428 views
Call another controller and get model of called controller
I am calling KitchenController from HomeController, how can I get KitchenController's Model in HomeController. public void KichenDetails(string KichenId) { if (string....
0 votes
1 answer
325 views
Call action method from one controller to another
I am working Asp.Net Core. I need to call the action method from one controller to another. I tried by using the RedirectToAction method. When I am using this, I get an error like "No route matched ...
1 vote
0 answers
358 views
How to execute a .NET Core controller action from service with check for authorization and validation?
I'm working on upgrade of our WebAPI and have an issue - how to execute the controller action from my code. I checked following question: how to call another controller action from a controller in ...
1 vote
2 answers
237 views
ASP.net mvc getting the logged username in non-action method returns null
I am trying to set role to the logged user but I can't get the logged user name in my non-action method called from another controller. I am missing something, because I get the error: "Object ...
0 votes
1 answer
313 views
Proper way to decouple business logic with dependencies from controllers
I am rusty in ASP.Net MVC and am struggling with the proper way to resolve a situation I have ran into on a large project that I inherited. The application has a large number of controllers that were ...
0 votes
1 answer
204 views
Shared Function Issue in MVC.NET
I am working on a MVC.NET project. I have some question about this technology. I have some functions ( or actions ) which are common between controllers. One of the ways to have shared function among ...