Ejemplo n.º 1
0
        private IQueryable <ThongBao> Filtering(IQueryable <ThongBao> thongBao, ThongBaoQuery query)
        {
            if (query.TinhTrang != null)
            {
                thongBao = thongBao.Where(x => x.TinhTrang == query.TinhTrang);
            }

            return(thongBao);
        }
Ejemplo n.º 2
0
        public async Task <object> Get(int idUser, ThongBaoQuery query)
        {
            var thongBao = Sorting <ThongBao> .Get(Filtering(db.ThongBao.Where(x => x.IdUser == idUser), query), query);

            return(new
            {
                Total = thongBao.Count(),
                Content = await Paging <ThongBao> .Get(thongBao, query).ToListAsync()
            });
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Get([FromQuery] ThongBaoQuery query)
        {
            int idUser = User.GetIdUser();

            return(Ok(await thongBaoService.Get(idUser, query)));
        }