예제 #1
0
 //
 // GET: /Home/
 public ActionResult Index()
 {
     var model = new HomeIndexViewModel
     {
         ElementaryMath = new ElementaryMath()
     };
     return View(model);
 }
예제 #2
0
        public ActionResult Index(ElementaryMath elementaryMath)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    elementaryMath.Compute();
                }
                catch (Exception e)
                {
                    ModelState.AddModelError(String.Empty, e.Message);
                }
            }

            var model = new HomeIndexViewModel
            {
                ElementaryMath = elementaryMath
            };

            return View(model);
        }