Пример #1
0
        public async Task <JsonResult> GetAsync([FromQuery] MemberQueryDto condition, int?pageIndex, int?pageSize)
        {
            if (pageIndex == null || pageSize == null)
            {
                if (condition.BirthdayFrom != null ||
                    condition.BirthdayTo != null ||
                    condition.DepartmentCode != null ||
                    condition.Education != null ||
                    condition.EntryTimeFrom != null ||
                    condition.EntryTimeTo != null ||
                    condition.Gender != null ||
                    condition.HomeAddress != null ||
                    condition.LengthOfService != null ||
                    condition.MaritalStatus != null ||
                    condition.MemberCode != null ||
                    condition.Nationality != null ||
                    condition.PersonnelNature != null ||
                    condition.PoliticalStatus != null ||
                    condition.Position != null ||
                    condition.Status != null
                    )
                {
                    var list = _service.Search(condition);
                    return(new JsonResult(new
                    {
                        code = 20000,
                        list
                    }));
                }
                var items = await _service.GetAll();

                return(new JsonResult(new
                {
                    code = 20000,
                    items
                }));
            }
            else
            {
                var items = await _service.GetPaginationAsync(pageIndex.Value, pageSize.Value);

                return(new JsonResult(new
                {
                    code = 20000,
                    items
                }));
            }
        }