Пример #1
0
        private IResponse PostRequest(IRequest request)
        {
            var form         = request.GetFormParameters();
            var name         = String.IsNullOrWhiteSpace((string)form["myName"]) ? "[Too lazy to enter name]" : form["myName"];
            var pageTemplate = new PostBackHandlerView
            {
                Model = new
                {
                    IsPostBack = true,
                    Form       = form,
                    Name       = name
                }
            };

            return(new Response(200, "OK", body: pageTemplate.TransformText()));
        }
Пример #2
0
        private IResponse GetRequest(IRequest request)
        {
            var pageTemplate = new PostBackHandlerView
            {
                Model = new
                {
                    IsPostBack = false,
                    Flavors    = new[]
                    {
                        "Vanilla",
                        "Chocolate",
                        "Cherry"
                    }
                }
            };

            return(new Response(200, "OK", new Dictionary <String, Object>(), pageTemplate.TransformText()));
        }