コード例 #1
0
ファイル: HomeController.cs プロジェクト: jdbrouwer3/john-ms
        public IActionResult Index()
        {
            ViewData["CurrentTime"] = DateTime.Now;
            ViewBag.TimeNow         = DateTime.Now;

            var i = new Invite();

            ViewBag.Name = "fred";
            i.AreYouComing(ViewBag.Name);

            if (i.Rsvp)
            {
                return(View("Pass"));
            }

            return(View("Fail"));
        }
コード例 #2
0
        public IActionResult Index()
        {
            ViewData["CurrentTime"] = DateTime.Now; // only controller to view
            ViewBag.TimeNow         = DateTime.Now; // only controller to view
            ViewBag.Name            = "";


            var i = new Invite();

            i.AreYouComing("Fred");

            if (i.RSVP)
            {
                ViewBag.Name = i.Name;
                return(View("Pass"));
            }

            return(View("Fail"));
        }
コード例 #3
0
        public IActionResult Index()
        {
            //Only goes from controller to view //Controller(data) ->View  View(Rendering)->Controller
            ViewData["CurrentTime"] = DateTime.Now;
            ViewBag.CurrentTime     = DateTime.Now;


            var i = new Invite();

            ViewBag.Name = "fred";
            i.AreYouComing(ViewBag.Name);


            if (i.Rsvp)
            {
                return(View("Pass"));
            }
            else
            {
                return(View("Fail"));
            }
        }