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 4618060
In Process

The Archive Base Latest Questions

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

I have a product with array of prices. I want that based on the

  • 0

I have a product with array of prices. I want that based on the user group the corresponding price will be displayed.

As far i created roles that are describing these groups

  1. Admin
  2. UserPriceA
  3. UserPriceB
  4. UserPriceC

I would like somehow to get current users role.

Something like this:

public decimal Price {
    get
    {
        var price = Prices.First(p => p.PriceType.Name == Something.CurentUser.Role);
        return price; 
    }
}
  • 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-22T02:12:46+00:00Added an answer on May 22, 2026 at 2:12 am

    You can write a conditional statement based on the name of each role. Based on if the user is a member of the role, execute a different LINQ statement.

    if (User.IsInRole("Admin")) {
        // ...
    }
    else if (User.IsInRole("UserPriceA")) {
       // ...
    }
    else if (User.IsInRole("UserPriceB")) {
       // ...
    }
    else if (User.IsInRole("UserPriceC")) {
       // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string: <products type=array> <product><brand>Rho2</brand> <created-at type=datetime>2011-11-03T21:29:46Z</created-at><id type=integer>78013</id><name>Test2</name> <price nil=true/> <quantity nil=true/>
I have a table that is created dynamically, and I want to put an
I have an array that has been serialized by php, the result is: unserialize('a:2:{s:13:custom_basket;a:1:{i:280583837398;a:4:{s:12:product_name;s:0:;s:8:quantity;s:1:1;s:5:price;d:38.649999999999999;s:11:description;a:7:{s:2:id;s:12:280583837398;s:3:sku;s:0:;s:4:site;s:2:UK;s:12:condition_id;s:4:1000;s:14:transaction_id;s:12:773563256018;s:8:platform;s:4:eBay;s:18:order_line_item_id;s:25:280583837398-773563256018;}}}s:6:basket;a:0:{}}')
I have a object (product), with a property of type 'array' e.g. product.tags =
i have wrote a script to produce an array of data but now want
I have some Javascript code that creates 2 arrays: One for Product Category and
I have two arrays. If a user adds a product, we put it in
I have a .txt file with product data, which I want to read in
I have a listview with custom array adapter, the view allows the user to
Language: Ruby I have an array of Products. Each Product has an attribute called

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.