Assign existing view to a controller

Asked

Viewed 118 times

-2

I have a view q is assigned to a controller. Everything was in this controller. Now we decided to create a controller for every situation we have here. Only I wouldn’t want to create a new view, because one already exists. This view is called Hotel. I created a controller called Hotel and an Action with the same name. I want to assign this Action to this view. I can’t put it in Action like this: Return View(Hotel); because the Return of this action is a parameter passed to Action, which looks like this: Return View(_package); If you give an Add view, you will create a new one. Is there any way you can do what you’d like? I’m waiting.

1 answer

2

Just put your View in the directory Shared. So all the Controllers may call the View Hotel as follows:

return View("Hotel", _package);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.