public void ProcessRequest(HttpContext context) { Dictionary <String, object> res = new Dictionary <string, object>(); List <Object> finalList = new List <object>(); IEnumerable <PilotClassDefinition> achs = PilotClassDefinition.getAll(); foreach (PilotClassDefinition r in achs) { IEnumerable <PilotClassPrereq> pre = PilotClassPrereq.getPrereqs(r.PilotClassID); Dictionary <string, string> obj = new Dictionary <string, string>(); obj.Add("PilotClass", r.PilotClassName); obj.Add("PilotLogo", r.Logo); obj.Add("Prerequisites", pre.Count <PilotClassPrereq>().ToString()); obj.Add("actions", r.PilotClassID.ToString()); obj.Add("PilotClassID", r.PilotClassID.ToString()); obj.Add("PilotClassDescription", r.PilotClassDescription); finalList.Add(obj); } res.Add("data", finalList); string json = JsonConvert.SerializeObject(res); context.Response.Write(json); }
protected void Page_Load(object sender, EventArgs e) { mUser = (AppUser)Session[Constants.SESS_KEY_USER]; if (mUser == null) { getUserFromCookie(); if (mUser == null) { Response.Redirect("login.aspx"); Response.Close(); return; } } items = PilotClassDefinition.getAll(); }