public ActionResult Index()
        {
            IUnit unit = new Unit() { Name = Measure.MegaByte, Value = 1 };

            MeasuresCalculator m = new MeasuresCalculator(unit, KiloMultiplier.k2);
            
            ViewBag.Kilo = GetKilo();
            ViewBag.Quantity = 1;
            
            return View(m);
        }
示例#2
0
        static void Main(string[] args)
        {
            IUnit unit = new Unit() { Name = Measure.MegaByte, Value = 1};

            MeasuresCalculator m = new MeasuresCalculator(unit, KiloMultiplier.k2);

            foreach (var item in m.Units)
            {
                Console.WriteLine("{0} - {1}", item.Name, item.Value);
            }

        }
        public ActionResult Index(int Quantity, int Type, int Kilo)
        {
            IUnit unit = new Unit() { Name = (Measure)Type, Value = (int)Quantity };

            MeasuresCalculator m = new MeasuresCalculator(unit, (KiloMultiplier)Kilo);

            //IEnumerable<SelectListItem> kilo = new List<SelectListItem>
            //{
            //    new SelectListItem(){Text=((int)KiloMultiplier.k2).ToString(), Value = ((int)KiloMultiplier.k2).ToString(),Selected=true},
            //    new SelectListItem(){Text=((int)KiloMultiplier.k1).ToString(), Value = ((int)KiloMultiplier.k1).ToString()}
            //};

            ViewBag.Quantity = Quantity;
            ViewBag.Kilo = GetKilo((KiloMultiplier)Kilo);

            return View(m);
        }