示例#1
0
        [HttpGet("dojodachi")]     //Http Method and the route
        public IActionResult Index()
        {
            DachiModel MyDachiModel = new DachiModel()
            {
                Name      = "DachiOne",
                Fullness  = 70,
                Happiness = 45,
                Meals     = 3,
                Energy    = 85
            };

            string SessionFeed = HttpContext.Session.GetString("SessionFeed");

            string SessionPlay = HttpContext.Session.GetString("SessionPlay");

            string SessionWork = HttpContext.Session.GetString("SessionWork");

            string SessionSleep = HttpContext.Session.GetString("SessionSleep");

            // HttpContext.Session.GetInt32("Fullness");

            // HttpContext.Session.GetInt32("Happiness");

            // HttpContext.Session.GetInt32("Meals");

            // HttpContext.Session.GetInt32("Energy");

            HttpContext.Session.SetObjectAsJson("DachiObject", MyDachiModel);

            return(View("Index"));
        }
示例#2
0
 public IActionResult Sleep(DachiModel target)
 {
     HttpContext.Session.SetString("SleepMessage", "Your Dachi is resting! +50 Energy!");
     return(View("Index"));
 }
示例#3
0
 public IActionResult Work(DachiModel target)
 {
     HttpContext.Session.SetString("WorkMessage", "You worked your Dachi! +2 Meals -10 Energy!");
     return(View("Index"));
 }
示例#4
0
 public IActionResult Play(DachiModel target)
 {
     HttpContext.Session.SetString("PlayMessage", "You Played with your Dachi! +55 Happiness, -25 Energy!");
     return(View("Index"));
 }