public IActionResult GetByYachtTour([FromQuery] YachtTourExternalRefLinkSearchModel searchModel) { int tourId = DecryptValue(searchModel.YachtIdEncrypted); var result = _yachtExternalRefLinkServices.GetByYachtTourId(tourId, searchModel); if (result.IsSuccessStatusCode) { return(Ok(result)); } return(BadRequest()); }
public BaseResponse <PagedList <YachtTourExternalRefLinkModel> > GetByYachtTourId(int id, YachtTourExternalRefLinkSearchModel searchModel) { try { var query = _db.YachtTourExternalRefLinks.Where(x => !x.Deleted && x.YachtTourFid == id); if (query.Count() > 0) { var data = query.Select(k => _mapper.Map <YachtTourExternalRefLinks, YachtTourExternalRefLinkModel>(k)); var result = new PagedList <YachtTourExternalRefLinkModel>(data, searchModel.PageIndex, searchModel.PageSize); if (result != null) { return(BaseResponse <PagedList <YachtTourExternalRefLinkModel> > .Success(result)); } return(BaseResponse <PagedList <YachtTourExternalRefLinkModel> > .BadRequest()); } return(BaseResponse <PagedList <YachtTourExternalRefLinkModel> > .BadRequest()); } catch (Exception ex) { return(BaseResponse <PagedList <YachtTourExternalRefLinkModel> > .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }