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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:50:18+00:00 2026-05-25T12:50:18+00:00

Any guidance or pointing me to an example would be much appreciated (I can’t

  • 0

Any guidance or pointing me to an example would be much appreciated (I can’t formulate a good search term on the Googleplex).

I have a model using enums that i define in a dictionary and then render on the view with @Html.RadioButtonFor, etc.

Here is an example of my model:

public PaymentPlanList PaymentPlan { get; set; }
        public enum PaymentPlanList
        {
            PaymentPlan_One,
            PaymentPlan_Two,
        }
        public class PaymentPlanDictionary
        {
            public static readonly Dictionary<PaymentPlanList, string> paymentplanDictionary = new Dictionary<PaymentPlanList, string>
            {
            { PaymentPlanList.PaymentPlan_One, "One full payment in advance (receive the lowest price)." },
            { PaymentPlanList.PaymentPlan_Two, "Two payments: first payment of 50% due up front, the balance of 50% due within 30 days (increases fee by $100)." },
            };
            static string ConvertPaymentPlan(PaymentPlanList paymentplanlist)
            {
                string name;
                return (paymentplanDictionary.TryGetValue(paymentplanlist, out name))
                    ? name : paymentplanlist.ToString();
            }
            static void Main()
            {
                Console.WriteLine(ConvertPaymentPlan(PaymentPlanList.PaymentPlan_One));
                Console.WriteLine(ConvertPaymentPlan(PaymentPlanList.PaymentPlan_Two));
            }
        }

And, for completeness, this is my view related to the above:

<p>
    @Html.RadioButtonFor(m => m.PaymentPlan, "PaymentPlan_One")
    One full payment in advance (receive the lowest price).
</p>
<p>
    @Html.RadioButtonFor(m => m.PaymentPlan, "PaymentPlan_Two")
    Two payments: first payment 50% due up front, the balance of 50% due within 30 days (increases fee by $100).
</p>

This is a quote system I have users fill out. For this particular service, say I charge $1,000.00. This is the base price. Based on user input, this price will be changed, and I want to show that to the user. So, if the user selects the first option, the price remains unchanged. If the user selects the second option, the fee is increased by $100.00.

This changes exponentially, since there are more inputs that affect the price (if selected).

Ultimately, based on the user inputs, I need to calculate the total. I am rendering a view which will display the total. I was thinking of using some @{} blocks and if/else if statements to either a) show nothing if what was selected does not increase the total, or b) showing the additional amount (e.g., $100.00), and then later showing a total.

Something like (EDITING here for clarity):

  • Base service: $1,000.00
  • Addon service1: $100.00 (only if user selects “PaymentPlan_Two” for two payments of 50% each (from the PaymentPlanList enum), otherwise hidden (and no addition of the $100.00) if user selects “PaymentPan_One” and pays in full)
  • Addon service2: $0.00 (this is hidden and a $0.00 or no value since the user did not select anything from a separate enum, but the value of $100.00 would be added if selected, which would make the Total $1,200.00 if it were selected; ALTERNATIVELY, how could I handle if there were 3 or more items in the list? E.g., Choice_One is $0.00, Choice_Two is $100.00 and Choice_Three is $200.00)
  • TOTAL: $1,100.00

Thanks for any help.

  • 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-25T12:50:18+00:00Added an answer on May 25, 2026 at 12:50 pm

    let’s see if I understand your requirements correctly:

    • The application needs to add prices to a base price, depending on
      selection of Addon services.
    • These selections are from a Dictionary, which is based on an Enum
    • Therefore we’re looking to store the price against the Enum to keep the data associations in one place.

    It is possible to store a single value against an Enum:

        public enum PaymentPlanList
        {
            PaymentPlan_One = 100,
            PaymentPlan_Two = 200,
        }
    

    However, I don’t think this would be flexible enough for our needs – Enums only allow integers, and are commonly used this way in bitwise operations (where the values are multiples of 2).

    I think a better solution here might be to use a Model-View-View-Model (MVVM) which can contain the logic about which services are available, how much they cost, and which services are valid in combination with other services.

    There’s an ticket pricing example (which sounds similar in concept to the domain here) on the Knockout.js home page that re-calculates a travel ticket price on the client web-page based on a user selection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any guidance on the following issue would be greatly appreciated. In which MDIParent event
Does anyone have any guidance or recommendations for writing a MIDI-based application in C#
Does Python3 have a built in method to do this? Any guidance at all
I have been straggling as to how to implement the following scenario. Any guidance
Is there any guidance on how to write modular Ember.js apps? I have seen
I have been searching all over but I can't find any answer to this.
example divisible([L1],X) :- L1 mod X =:= 0. query divisible([4,6,8,7],2). response [4,6,8] Any guidance?
I have an RSS feed URL, that I can view in any Feed Reader.
Do folks have any guidance on when a simple .NET property that fires INotifyPropertyChanged.PropertyChanged
I am new to Ruby and Ror so any guidance would be awesome. I

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.