Пример #1
0
        public async Task <IActionResult> Get()
        {
            IEnumerable <set_integral> entityDto = null;
            await Task.Run(() =>
            {
                entityDto = _setIntegralRpt.FindBy(f => f.IsValid);
            });

            var entity       = _mapper.Map <IEnumerable <set_integral>, IEnumerable <SetCardIntegralDto> >(entityDto).ToList();
            var cardTypeList = _setCardRpt.GetAll().ToList();

            foreach (var hs in entity)
            {
                hs.CardTypeTxt = cardTypeList.FirstOrDefault(f => f.Id == hs.CardType)?.Name;
            }
            return(new OkObjectResult(entity));
        }
Пример #2
0
        public async Task <IActionResult> Get()
        {
            IEnumerable <set_integral> entityDto = null;
            await Task.Run(() =>
            {
                entityDto = _setIntegralRpt.FindBy(f => f.IsValid);
            });

            var entity          = _mapper.Map <IEnumerable <set_integral>, IEnumerable <SetCardIntegralDto> >(entityDto).ToList();
            var cardTypeList    = _setCardRpt.GetAll().ToList();
            var houstTypeList   = _setHouseTypeRepository.GetAll().ToList();
            var serviceItemList = _yxServiceitemRepository.GetAll().ToList();
            var goodsList       = _kcGoodsRepository.GetAll().ToList();

            foreach (var hs in entity)
            {
                hs.CardTypeTxt    = cardTypeList.FirstOrDefault(f => f.Id == hs.CardTypeId)?.Name;
                hs.HouseTypeTxt   = houstTypeList.FirstOrDefault(f => f.Id == hs.HouseTypeId)?.TypeName;
                hs.ServiceItemTxt = serviceItemList.FirstOrDefault(f => f.Id == hs.ServiceItemId)?.Name;
                hs.GoodsTxt       = goodsList.FirstOrDefault(f => f.Id == hs.GoodsId)?.Name;
            }
            return(new OkObjectResult(entity));
        }