EasyUi+mvc增删改查

1.首先得下载EasyUi包。


2.前端html代码如下:

@*
    For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    ViewBag.Title = "拍卖会列表";
    Layout = null;
}

@using Microsoft.AspNetCore.Html



   
    518大学生创业拍卖会
   

   
   
   
   
   
 
   
   


   
   


   
         closed="true">
       

           

               
               
           

           

               
               
           

           

               
               
           

            
       

       
   





Controller代码:


    public string Load()
        {
            MeetinfoBLL meetbll = new MeetinfoBLL();
            MeetinfoDal meetdal = new MeetinfoDal();
            List list = meetbll.GetMeetList(meetdal, null);
            //return strJson;
            return Newtonsoft.Json.JsonConvert.SerializeObject(list);

        }


        [HttpDelete]
        public JsonResult Delete(int ID)
        {
            MeetinfoBLL meetbll = new MeetinfoBLL();
            MeetinfoDal meetdal = new MeetinfoDal();
            bool f = meetbll.Del(ID);
            Dictionary result = new Dictionary();
            result.Add("isSuccess", f);

            return new JsonResult(Json(result));
        }

        [HttpPost]
        public string send([FromBody] MeetinfoDal data)
        {
            MeetinfoBLL meetbll = new MeetinfoBLL();
            MeetinfoDal meetdal = new MeetinfoDal();
            string name = data.MeetName;
            string cjr = data.Creater;
            string desc = data.Desc; ;
            //添加数据
            meetdal.MeetName = name;
            meetdal.BeginTime = DateTime.Now;
            meetdal.Endtime = DateTime.Now;
            meetdal.Creater = cjr;
            meetdal.Addtime = DateTime.Now;
            meetdal.Desc = desc;
            bool a = meetbll.AddReturnBool(meetdal);
            if (a == true)
            {
                return "success";
            }
            else
            {
                return "false";
            }
        }

        [HttpPost]
        public string Updateinfo([FromBody]dynamic data)
        {
            MeetinfoBLL meetbll = new MeetinfoBLL();
            MeetinfoDal meetdal = new MeetinfoDal();
            Dictionary obj = new Dictionary();
            obj = HttpHelper.JsonToDictionary(data);
            string name = obj["MeetName"].ToString();
            string cjr = obj["Creater"].ToString();
            string desc = obj["Desc"].ToString();
            int id = int.Parse(obj["Id"].ToString());
            meetdal = meetbll.GetById(id);
            meetdal.Desc = desc;
            meetdal.MeetName = name;
            meetdal.BeginTime = DateTime.Now;
            meetdal.Endtime = DateTime.Now;
            meetdal.Creater = cjr;
            bool b = meetbll.UpdateReturnBool(meetdal);
            if (b == true)
            {
                return "success";
            }
            else
            {
                return "false";
            }
        }

显示效果截图EasyUi+mvc增删改查_第1张图片EasyUi+mvc增删改查_第2张图片EasyUi+mvc增删改查_第3张图片EasyUi+mvc增删改查_第4张图片


你可能感兴趣的:(asp.net学习总结,asp.net学习)