示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
 public async Task <ActionResult <List <NoticeDto> > > GetList([FromQuery] NoticeSearchDto search)
 {
     return(Result(await _noticeService.GetListAsync(search)));
 }
示例#4
0
 public async Task <ActionResult <List <NoticeDto> > > GetList([FromQuery] NoticeSearchDto search)
 {
     if (_userContext is null || _userContext.Id == 0)
     {
         return(await Task.FromResult(new List <NoticeDto>()));
     }