I am confused and want to know the best practice for the use same information in multiple action methods. I have five values that I want to use in multiple action methods. I have model class which have that five values.
Currently I am storing data into session and getting that data in every action method where I need It.
[HttpPost]
public ActionResult Index(Model model){
Session["A"]=mode.a;
Session["B"]=mode.b;
Session["C"]=mode.c;
Session["D"]=mode.d;
Session["D"]=mode.d;
}
[HttpGet]
public ActionResult Action1(){
Label1.Text=Session["A"];
Label2.Text=Session["B"];
Label3.Text=Session["C"];
Label4.Text=Session["D"];
Label5.Text=Session["E"];
}
[HttpGet]
public ActionResult Action2(){
Label1.Text=Session["A"];
Label2.Text=Session["B"];
Label3.Text=Session["C"];
Label4.Text=Session["D"];
Label5.Text=Session["E"];
}
So simply my question is Can I pass that object of model class in every action method? Or there is any other best practice to use that object of the model class in every action method or using the session is better way ?
My all action method's views uses the same `model class.