Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:12:42+00:00 2026-05-26T02:12:42+00:00

I am not sure how to put this question or where to ask it,

  • 0

I am not sure how to put this question or where to ask it, lets say i have a cms, which has three types of users, a retailer, manufacturer and a customer support (this guy can access all the information that a retailer and manufacturer can access). Now let say there is a products controller that has an action method called “view products list”. Now a retailer can only view products on his website and so can a manufacturer, but a customer support can view a list of manufacturers and retailers and choose on which one’s products s/he wants to view. Lets say all this code is in the same action method “view products list”. Now is this a good practice ? To have all the code for all three types of users in the same action method ? Second how do i figure out which code should (if condition) should run inside the action method based on the user type assuming that i am using mvc built in login system and roles.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:12:42+00:00Added an answer on May 26, 2026 at 2:12 am

    (1) It’s fine to have this in one action method, you don’t want to be creating new action methods if new roles are added.

    (2) You can use e.g.

    If User.IsInRole("CustomerSupport") { ... }
    

    You might also want to consider locking down the action method so that only roles catered for inside the method are allowed access. Use the [Authorize] attribute to accomplish that. E.g.

    [Authorize(Roles = "Retailer, Manufacturer, CustomerSupport")]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not quite sure how to correctly put this question. I want to dynamically
I'm not really sure where to put this question (it's not really webapps or
Not sure how to ask a followup on SO, but this is in reference
Not sure exactly how to word this question ... so edits are welcomed! Anyway
I'm not pretty sure if this question is for here, but I want to
Am not sure how to put this, and I couldn't find the answer because
I'm not sure the right way to do this, so I wanted to ask
I wasn't really sure if this was the right site to put this question
I'm new here so i'm not sure if this the right place to ask
I'm not sure how to ask this so i am having a hard time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.