示例#1
0
        public IActionResult Horse(IFormCollection info)
        {
            //Gör att konstruktorn körs
            PersonData rider = new PersonData();

            //läser in det som samlats i IFormCollection
            //namnges som i input-delen
            rider.HorseName = info["HorseName"];
            rider.Name      = info["Name"];
            rider.Weight    = Convert.ToInt32(info["Weight"]);
            rider.Length    = Convert.ToInt32(info["Length"]);
            rider.Date      = Convert.ToDateTime(info["Date"]);
            rider.calculateHorseMatch();

            string sessionstring = JsonConvert.SerializeObject(rider);

            HttpContext.Session.SetString("somesession", sessionstring);

            return(View(rider));
        }