Example #1
0
        public ActionResult Update()
        {
            var keys = new Dictionary <string, object>();

            if (Request.QueryString.Count > 0)
            {
                foreach (var key in Request.QueryString.AllKeys)
                {
                    keys.Add(key, Request.QueryString[key]);
                }
            }

            var data = StructureHelper.Detail(tableSlug, keys);

            ViewData.Model = data;
            if (Request.HttpMethod == "POST")
            {
                var form = Request.Form;
                foreach (var key in form.AllKeys)
                {
                    data.Data[key] = form[key];
                }
                //TODO validation

                StructureHelper.Update(tableSlug, data.Data);

                ViewBag.msg = "updated";
            }
            return(View());
        }