Пример #1
0
        public IActionResult SearchProduct([FromBody] SearchProductReq req)
        {
            var res = new SingleRsp();
            var m   = new object();

            if (req.Id == 0)
            {
                if (req.categoryId == 0)
                {
                    m = _svc.SearchProduct(req.keyword, req.Page, req.Size);
                }
                else
                {
                    m = _svc.searchProductsByCategory(req.keyword, req.Page, req.Size, req.categoryId);
                }
            }
            else if (req.Id == 1)
            {
                m = _svc.findProductBetweenPrice(req.FPrice, req.LPrice, req.Page, req.Size);
            }
            res.Data = m;

            return(Ok(res));
        }