Skip to content

Create Pages in ASP.NET and distribute Controller

Himanshu Pandya

Asked Jul 8, 2014, 11:37 PM EDT5 answers
Share
LinkedInX
I am creating a simple ASP.NET application and want to know about that 
How can I distribute Controller for different pages ?
 
Try to create pages and distribute controller of those pages as per logical binding. e.g public accessible in different controller and private accessible in different controller.

5 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    In MVC each controller ideally has corresponding Model & View.

    So, employee.cshtml has EmployeeController and Employee (Model) kinda structure.

    Now, what do you want to see as public/private split, can you please elaborate by expanding above Employee example?

    twitter @sumitjolly
    0
  • 0
    Thanks for your post. Now if we have some pages of employee, some of company admin and some of public view(To show all). So how can we define controller for them and how can it be implemented ?
    0
  • 0
    One quick question:

    Are pages separate for all these 3 parties
    - Public
    - Admin
    - Employees 

    OR
    - Same pages but depending upon Public | Employee | Admin pages will render different content?
    0
  • 0
    Yes!! they are same pages, only some contents are different.
    0
  • 0
    so you can handle via same Controller but use different views. Ex-

    public void RenderPage()
    {
    switch (authorization)
    {
        case "Admin":
                   return View("admin");

        case "Public":
                   return View("admin");
      case "Employees":
                   return View("employee");
    }

    }


    twitter @sumitjolly
    0