コード例 #1
0
        public void html([Bind(Prefix = "id")] string name)
        {
            Goals goals = new Goals(SessionProvider.CurrentSession);
            Sports sports = new Sports(SessionProvider.CurrentSession);
            var goalList = goals.GetAllBySport(sports.GetByName(name));
            string html = "<ul>";
            foreach (Goal goal in goalList)
            {
                html += string.Format("<li> -Name: {0} <br/>-Description: {1}</li>", goal.Name, goal.Description);
            }
            html += "</ul>";

            Response.Write(html);
        }
コード例 #2
0
        public ActionResult JsonSport([Bind(Prefix = "id")] string name)
        {
            Goals goals = new Goals(SessionProvider.CurrentSession);
            Sports sports = new Sports(SessionProvider.CurrentSession);
            var goalList = goals.GetAllBySport(sports.GetByName(name));

            var jsonGoals = JsonBuilder.BuildJsonGoal(goalList);

            return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet);
        }