Exemplo n.º 1
0
        public BaseResponse <PagedList <HotelAttributeViewModel> > Search(HotelAttributeSearchModel searchModel)
        {
            if (searchModel == null)
            {
                return(BaseResponse <PagedList <HotelAttributeViewModel> > .BadRequest());
            }
            var entity = _db.HotelAttributes.AsNoTracking().Where(k => k.Deleted == false && k.AttributeCategoryFid == searchModel.AttributeCategoryFid).Select(s => _mapper.Map <HotelAttributes, HotelAttributeViewModel>(s));

            if (entity.Count() > 0)
            {
                return(BaseResponse <PagedList <HotelAttributeViewModel> > .Success(new PagedList <HotelAttributeViewModel>(entity, 1, 10)));
            }
            return(BaseResponse <PagedList <HotelAttributeViewModel> > .NoContent(new PagedList <HotelAttributeViewModel>()));
        }
        public IActionResult Search([FromQuery] HotelAttributeSearchModel model)
        {
            var response = _hotelAttributeService.Search(model);

            return(Ok(response));
        }