예제 #1
0
파일: form.cs 프로젝트: KelsonBall/Project3
        public form()
        {
            Get += (Context context) =>
            {
                int next = 0;
                if (context.Request.Query.ContainsKey("stateid") &&
                    context.Request.Query.ContainsKey("textfield1") &&
                    context.Request.Query.ContainsKey("textfield2") &&
                    context.Request.Query.ContainsKey("textfield3"))
                {
                    State previous = Journey.GetState(int.Parse(context.Request.Query["stateid"]));
                    if (context.Request.Query["textfield1"].Equals(previous.Prompt1))
                    {
                        next = previous.Prompt1NextId;
                    }
                    else if (context.Request.Query["textfield2"].Equals(previous.Prompt2))
                    {
                        next = previous.Prompt2NextId;
                    }
                    else if (context.Request.Query["textfield3"].Equals(previous.Prompt3))
                    {
                        next = previous.Prompt3NextId;
                    }
                }
                Dictionary <string, object> model = new Dictionary <string, object>
                {
                    { "state", Journey.GetState(next) }
                };
                context.Response.Write(_views.RenderView("form.html", model));
            };

            Post += context =>
            {
            };
        }