Adalat  Khan

Adalat Khan

  • 647
  • 1.5k
  • 870k

Redirect from Concrete Classes

Apr 16 2022 12:09 AM

Hi,

The ViewData, ViewBag are normally working in the Controller classes. Is there any way to use these features inside in Concrete classes  or can we redirect to the Action method of a controller from the Concrete classes ?. For example can we use the following statements in the Concrete classes (Not in the Controller):

ViewData["Notfound"] = "The requested role with the Id {0} not found" + id;
                return View("NotFound");

 

Is there any way or it is not possible???

For example, i have one Controller class, one Interface and one Service class so i want to use ViewData in my Service Class and Redirect to Action method of the Controller from my Service Class.


Answers (1)