zoukankan      html  css  js  c++  java
  • .Net MVC删除图片

    还在学校,菜鸟级别,接触到的只是 
      /// <summary>
            /// 根据imageID删除图片
            /// </summary>
            /// <returns></returns>
            public int deleteImage(image im)
            {
                return new InfoService().deleteImage(im);
            }

    DAL = > BLL => UI
       /// <summary>
            /// 根据ImgID删除图片
            /// </summary>
            /// <param name="imgID"></param>
            /// <returns></returns>
            public JsonResult delImg(string imgID)
            {
                img.imageID = Convert.ToInt32(imgID);
                int result = im.deleteImage(img);
                JsonResult json = new JsonResult();
                if (result > 0)
                {
                    json.Data = new { data = "Success" };
                    json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                }
                else
                {
    
                    json.Data = new { data = "Failed" };
                    json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                }
                return json;
            }
     $(".btnDel").click(function () {
                    var imgID=$(this).data('del');
                    //询问框
                    layer.confirm('您确定删除吗?', {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        $.ajax({
                            url: '/Info/delImg',
                            type: "get",
                            data: {
                                imgID:imgID
                            },
                            success: function (data) {
                                if (data.data == "Success") {
                                    layer.msg('删除成功', { icon: 1 });
                                }
                            }, error: function (data) {
                                layer.msg('删除失败', { icon: 2 });
                            }
                        })
                        //layer.msg('删除按钮被点击', { icon: 1 });
                        //去删除
                    }, function () {
                        layer.msg('取消按钮被点击', {
                            time: 20000, //20s后自动关闭
                            btn: ['明白了', '知道了']
                        });
                    });
                });


  • 相关阅读:
    手机号码正则表达式
    POJ 3233 Matrix Power Series 矩阵快速幂
    UVA 11468
    UVA 1449
    HDU 2896 病毒侵袭 AC自动机
    HDU 3065 病毒侵袭持续中 AC自动机
    HDU 2222 Keywords Search AC自动机
    POJ 3461 Oulipo KMP模板题
    POJ 1226 Substrings KMP
    UVA 1455 Kingdom 线段树+并查集
  • 原文地址:https://www.cnblogs.com/MartinLee/p/7622719.html
Copyright © 2011-2022 走看看