public async Task <AppSrvResult <List <NoticeDto> > > GetListAsync(NoticeSearchDto search) { var whereCondition = ExpressionCreator .New <SysNotice>() .AndIf(search.Title.IsNotNullOrWhiteSpace(), x => x.Title == search.Title.Trim()); var notices = await _noticeRepository .Where(whereCondition) .ToListAsync(); return(Mapper.Map <List <NoticeDto> >(notices)); }
public async Task <AppSrvResult <List <NoticeDto> > > GetListAsync(NoticeSearchDto search) { Expression <Func <SysNotice, bool> > whereCondition = x => true; if (search.Title.IsNotNullOrWhiteSpace()) { whereCondition = whereCondition.And(x => x.Title == search.Title.Trim()); } var notices = await _noticeRepository.Where(whereCondition).ToListAsync(); return(Mapper.Map <List <NoticeDto> >(notices)); }
public async Task <ActionResult <List <NoticeDto> > > GetList([FromQuery] NoticeSearchDto search) { return(Result(await _noticeService.GetListAsync(search))); }
public async Task <ActionResult <List <NoticeDto> > > GetList([FromQuery] NoticeSearchDto search) { if (_userContext is null || _userContext.Id == 0) { return(await Task.FromResult(new List <NoticeDto>())); }