How do I move a list from one controller to another?
here is code of first controller : [HttpPost] public ActionResult Admin_Mgmt(List things, int Action_Code) { switch (Action_Code) { case 1: { //redirecting requesting to another controller return RedirectToAction(“Quran_Loading”, “Request_Handler”,things); } default: } }
How do I add a list to my controller?
Right-click on the controller folder and add UserController….2. Adding Controller
- List listuser = new List();
- UserModel users = new UserModel();
- users. UserName = “Devesh Omar”;
- users. Age = 12;
- users. Gender = “M”;
- listuser. Add(users);
- users = new UserModel();
- users. UserName = “Ram Kumar”;
How pass value from one controller to another in AngularJS?
Pass value from one controller to another in AngularJS
- var app = angular. module(“MyApp”, []);
- /* Create Products service */
- app. service(‘Products’, function () {
- this. Items = function() {
- // if we want can get data from database.
- product = { product: ”, price: ” }
- };
- return this;
Can we store list in ViewBag?
We will loop through each string items present in the ViewBag. BrandName dynamic property. Currently we have all the data in the item that we retrieved from the ViewBag. We have passed the indexed string key in the ViewData in which we are storing the new list object.
Is it possible to pass list from one controller to another?
Passing List from controller to another is not possible in actions, Because RedirectToAction is HTTP request that u can’t pass list to. you can check this reference here for more information about the difference between the three options.
How to pass data from one controller to another in MVC?
As shown above you can either use UpdateModel () method to transfer values from the route to the Customer object or you can have a parameter to the Index () action method. This technique is quite clean and makes use of MVC specific parts (route and route parameters).
How does sending data from one controller to another work?
Let’s quickly see how each of these three approaches work. This approach is possibly the most primitive one and involves no special consideration from your side. The action method sending the data can use Redirect () method or RedirectToAction () method to transfer the control to the receiving action method.
How to pass the list from one method to another?
Controller is having the different methods and each method want to check the user.name details in where clause of soql. Please let me know how to write a method and to hold the user.name details and use the same in all the methos where clause.