public LoketResponse GetListData(LoketRequest request) { var _laboratoriumId = _unitOfWork.PoliRepository.GetFirstOrDefault(x => x.Name == Constants.NameConstant.Laboratorium); if (_laboratoriumId == null) { _laboratoriumId = new Poli { ID = 0 } } ; Expression <Func <QueuePoli, bool> > _serachCriteria = x => x.PoliTo == _laboratoriumId.ID; List <LoketModel> lists = base.GetbaseLoketData(request, _serachCriteria); int totalRequest = lists.Count(); var response = new LoketResponse { Draw = request.Draw, RecordsFiltered = totalRequest, RecordsTotal = totalRequest, Data = lists }; return(response); }
protected List <SelectListItem> BindDropDownPoliList(int poliId) { Poli poli = _unitOfWork.PoliRepository.GetFirstOrDefault(x => x.ID == poliId); int poliType = poli.Type; // get valid poli from type var filteredPoliList = _unitOfWork.PoliFlowTemplateRepository.Get(x => x.PoliTypeID == poliType); // get all poli var qry = _unitOfWork.PoliRepository.Get(); IList <PoliModel> _poliListModel = new List <PoliModel>(); foreach (var item in qry) { if (filteredPoliList.Any(x => x.PoliTypeIDTo == item.Type)) { var _poli = Mapper.Map <Poli, PoliModel>(item); _poliListModel.Add(_poli); } } List <SelectListItem> _poliList = new List <SelectListItem>(); foreach (var item in _poliListModel) { _poliList.Add(new SelectListItem { Text = item.Name, Value = item.Id.ToString() }); } return(_poliList); }