コード例 #1
0
        public ActionResult InsertNewEnvio(String data)
        {
            Dictionary <String, Object> response = new Dictionary <String, Object>();
            Dictionary <String, Object> datos    = new Dictionary <String, Object>();
            var result = new JavaScriptSerializer().Deserialize <dynamic>(data);

            foreach (var obj in result)
            {
                datos.Add(obj["name"], obj["value"]);
            }

            Dictionary <String, Object> user_data = (Dictionary <String, Object>)Session["USER_DATA"];

            datos.Add("UsuarioRegistra", user_data["IdUsuario"]);

            bool resp = Paquetes.InsertEnvio(datos);

            if (resp)
            {
                response.Add("success", "true");
            }
            else
            {
                response.Add("error", "No se ha podido guardar el envío.");
            }

            return(Json(response, JsonRequestBehavior.AllowGet));
        }