public async Task <object> GetList(ExchangerSearchDto dto) { var query = GetQueryable(x => (x.Name.Contains(dto.Name) || string.IsNullOrEmpty(dto.Name)) && (x.Phone.Contains(dto.Phone) || string.IsNullOrEmpty(dto.Phone)) && (x.Phone.Contains(dto.Address) || string.IsNullOrEmpty(dto.Address)) && x.UserId == dto.UserId) .OrderByDescending(x => x.DateUpdate) .Skip(dto.Count * dto.Page).Take(dto.Count); var result = await query .Select(x => new { x.Id, x.Name, x.Phone, x.Address, City = x.City.Name, x.CityId, x.UserId }).ToListAsync(); var total = await query.CountAsync(); return(new { total = total, result = result }); }
public async Task <IActionResult> GetList(ExchangerSearchDto dto) { try { dto.UserId = CurrentUserId; return(Ok(await Logic.GetList(dto))); } catch (Exception ex) { return(ExceptionResult(ex)); } }
public async Task <object> GetList(ExchangerSearchDto dto) { return(await Repo.GetList(dto)); }