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);
            }
  • 相关阅读:
    bzoj2815: [ZJOI2012]灾难
    bzoj1188: [HNOI2007]分裂游戏
    bzoj4538: [Hnoi2016]网络
    bzoj3594: [Scoi2014]方伯伯的玉米田
    bzoj2595: [Wc2008]游览计划
    bzoj3277: 串
    Django开发:(3.2)ORM:多表操作
    Django开发:(3.1)ORM:单表操作
    Django:(2)视图层&模板层
    Django开发:(1)django基础 & url控制器
  • 原文地址:https://www.cnblogs.com/GuoLianSheng/p/13261202.html
Copyright © 2011-2022 走看看