zoukankan      html  css  js  c++  java
  • Mvc 修改


    @{
        ViewBag.Title = "Update";
    }
    <h2>Update</h2>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <div>
        <table>
            <tr>
                <td>日志标题</td>
                <td><input id="Title" type="text" /></td>
            </tr>
            <tr>
                <td>日志类型</td>
                <td>
                    <select id="LogTypeName">
                    </select>
                </td>
            </tr>
            <tr>
                <td>发布人</td>
                <td><input id="Issuer" type="text" /></td>
            </tr>
            <tr>
                <td>执行时间</td>
                <td><input id="ExeTime" type="date" /></td>
            </tr>
            <tr>
                <td>日志内容</td>
                <td><input id="Context" type="text" /></td>
            </tr>
        </table>
        <input id="save" type="button" value="修改" />
        <input id="Button1" type="button" value="取消" onclick="location.href = '/log/RecordList'" />
    </div>
    <script>
        $(function () {
            var SID = window.location.toString().split("?")[1].split("=")[1];
            Type();
            Update(SID);
            $("#save").click(function () {
                var obj = {};
                obj.ID = SID;
                obj.Title = $("#Title").val();
                obj.Lid = $("#LogTypeName").val();
                obj.Issuer = $("#Issuer").val();
                obj.ExeTime = $("#ExeTime").val();
                obj.Context = $("#Context").val();
                $.ajax({
                    url: "http://localhost:51251/api/Update",
                    data: { model: JSON.stringify(obj) },
                    dataType: "text",
                    type: "GET",
                    success: function (result) {
                        if (result > 0) {
                            alert("修改成功");
                            location.href = '/log/RecordList';
                        }
                        else {
                            alert("修改失败");
                        }
                    }
                });
            });
        });
        function Type() {
            $.ajax({
                url: "http://localhost:51251/api/ShowType",
                data: null,
                dataType: "text",
                type: "get",
                success: function (result) {
                    var std = JSON.parse(result);
                    $(std).each(function (i, n) {
                        $("#LogTypeName").append("<option value='" + n.ID + "'>" + n.LogTypeName + "</option>");
                    });
                }
            });
        }
        function Update(ID) {
            $.ajax({
                url: "http://localhost:51251/api/Rebellion",
                data: {ID: ID },
                dataType: "json",
                type: "get",
                success: function (result) {
                    $("#Title").val(result.Title);
                    $("#LogTypeName").val(result.LogTypeName);
                    $("#Issuer").val(result.Issuer);
                    $("#ExeTime").val(result.ExeTime);
                    $("#Context").val(result.Context);
                }
            });
        }
    </script>
     
     ///**//
       //问框框反填
            public RedPacketModel Show(string id)
            {
                string sql = "select * from RedPacket where ID=" + id + "";
                return dal.Query<RedPacketModel>(sql).First();
            }
      /// <summary>
            /// 反填
            /// </summary>
            [Route("api/Rebellion")]
            [HttpGet]
            public RedPacketModel Rebellion(string ID)
            {
                return bll.Show(ID);
            }
  • 相关阅读:
    常看本地是否安装Git和maven工具
    Git 安装和使用Tips
    Jmeter 获取系统时间,和对系统时间进行增减时间
    Java 中的系统时间
    Go语言
    数据拆分之 垂直拆分 and 水平拆分
    在Windows和UNIX下利用PHP和LDAP进行身份验证
    Linux中使用crontab命令定时执行shell脚本或其他Linux命令
    php empty()和isset()的区别
    php 判断是否get传值的参数是否存在
  • 原文地址:https://www.cnblogs.com/GuoLianSheng/p/13261202.html
Copyright © 2011-2022 走看看