public static string List(HttpContext context) { if (string.IsNullOrEmpty(App.UserID)) throw new AuthenticationException("用户未登录"); int pageIndex = context.Request.QueryString["pageIndex"].ToInt(0); int pageSize = context.Request.QueryString["pageSize"].ToInt(10); FreedomDB.Bridge.Where where = new Where(); where.Add(new Where.Item("1", "=", "1")); var listUser = Bll.User_Bll.GetListUser(where, "*", "ID DESC", pageIndex, pageSize); PageJsonTpl<List<XK.Model.User_Model>> listJsonTpl = new PageJsonTpl<List<User_Model>>(); listJsonTpl.data = listUser; listJsonTpl.msg = ""; listJsonTpl.code = 1; listJsonTpl.total = Bll.User_Bll.GetRecordCount(where); listJsonTpl.pageindex = pageIndex; string extjson = Common.json.JsonHelper<PageJsonTpl<List<XK.Model.User_Model>>>.Serialize2Object(listJsonTpl); return extjson; }
public static string Delete(HttpContext context) { if (string.IsNullOrEmpty(App.UserID)) throw new AuthenticationException("用户未登录"); int uid = context.Request.GetValExt("uid").ToInt(); if (uid < 1) throw new ArgumentNullException("uid", "用户ID不能为空"); Where where=new Where(); where.Add(new Where.Item("ID", "=", uid)); bool success = Bll.User_Bll.DeleteUser(where); ApiInfo apiInfo = new ApiInfo(SystemCode.Error, "删除失败"); if (success) { apiInfo = new ApiInfo(SystemCode.Success, "删除成功"); } return apiInfo.ToJson(); }