Ejemplo n.º 1
0
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        public async Task <ApiResult <Page <SysPersonContactDto> > > GetPagesAsync(SysPersonContactPage parm)
        {
            var res = new ApiResult <Page <SysPersonContactDto> >();

            try
            {
                using (Db)
                {
                    var query = Db.Queryable <SysPersonContact>()
                                .Where(m => m.PersonGuid == parm.guid)
                                .OrderBy(m => m.AddTime).Select(m => new SysPersonContactDto()
                    {
                        Guid     = m.Guid,
                        Name     = m.Name,
                        Relation = m.Relation,
                        Mobile   = m.Mobile,
                        Address  = m.Address,
                        IsUrgent = m.IsUrgent
                    }).ToPageAsync(parm.page, parm.limit);
                    res.success = true;
                    res.message = "获取成功!";
                    res.data    = await query;
                }
            }
            catch (Exception ex)
            {
                res.message    = ApiEnum.Error.GetEnumText() + ex.Message;
                res.statusCode = (int)ApiEnum.Error;
            }
            return(await Task.Run(() => res));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> GetContactPages(SysPersonContactPage request)
        {
            var res = await _sysPersonContactService.GetPagesAsync(request);

            return(Json(new { code = 0, msg = "success", count = res.data.TotalItems, data = res.data.Items }));
        }