Example #1
0
        public async Task <IActionResult> PageData(int page, int limit, string MenuTitle)
        {
            string msg    = string.Empty;
            int    code   = 0;
            int    total  = 0;
            string sWhere = string.Empty;
            IEnumerable <ESysMenu> list = null;

            try
            {
                var param = new Dapper.DynamicParameters();
                if (!string.IsNullOrEmpty(MenuTitle))
                {
                    sWhere += " and MenuTitle like @MenuTitle";
                    param.Add("MenuTitle", string.Format("%{0}%", MenuTitle));
                }

                total = await _SysMenuRepository.GetTotalCount(sWhere, param);

                list = await _SysMenuRepository.GetPageAsync(page, limit, sWhere, param);
            }
            catch (Exception ex)
            {
                code = -1;
                msg  = ex.Message;
            }
            return(Ok(new { code = code, msg = msg, count = total, data = list }));
        }