Beispiel #1
0
        public ActionResult Add(long id)
        {
            var usr      = repository.GetUserById(sessionid.Value, subdomainid.Value);
            var settings = (UserSettings)usr.settings;
            var viewdata = new ShippingRuleViewModel
            {
                isMetric  = settings.HasFlag(UserSettings.METRIC_VIEW),
                currency  = usr.organisation1.MASTERsubdomain.currency.ToCurrencyCode(),
                profileid = id
            };

            return(View(viewdata));
        }
Beispiel #2
0
        public static ShippingRuleViewModel ToModel(this shippingRule rule, Currency currency, bool ismetric, bool showSymbols = true)
        {
            var viewData = new ShippingRuleViewModel()
            {
                id        = rule.id.ToString(),
                cost      = rule.cost.ToString("n" + currency.decimalCount),
                countryid = rule.country,
                state     = rule.state.ToStateName(rule.country.ToString()),
                name      = rule.name,
                ruleType  = (RuleType)rule.ruletype,
                isMetric  = ismetric,
                currency  = currency.symbol
            };

            viewData.country = rule.country.HasValue ?
                               Country.GetCountry(rule.country.Value).name : "Everywhere Else";
            viewData.matchValue = rule.matchvalue.ToMatchValueDisplay(viewData.ruleType, currency, ismetric, showSymbols);

            return(viewData);
        }