public async Task <IActionResult> Get() { IEnumerable <set_inte_house> entityDto = null; await Task.Run(() => { entityDto = _setInteHouseRpt.FindBy(f => f.IsValid); }); var entity = _mapper.Map <IEnumerable <set_inte_house>, IEnumerable <SetInteHouseDto> >(entityDto).ToList(); try { var houseTypeList = _setHouseTypeRpt.GetAll().ToList(); foreach (var hs in entity) { hs.HouseTypeTxt = houseTypeList.FirstOrDefault(f => f.Id == hs.HouseType)?.TypeName; } var cardTypeList = _setCardRpt.GetAll().ToList(); foreach (var hs in entity) { hs.CardTypeTxt = cardTypeList.FirstOrDefault(f => f.Id == hs.CardType)?.Name; } } catch (Exception e) { Console.WriteLine(e); } return(new OkObjectResult(entity)); }
public async Task <IActionResult> Get() { IEnumerable <fw_houseinfo> entityDto = null; await Task.Run(() => { entityDto = _fwHouseinfoRpt.FindBy(f => f.IsValid); }); var entity = _mapper.Map <IEnumerable <fw_houseinfo>, IEnumerable <HouseinfoDto> >(entityDto).ToList(); var houseTypeList = _setHouseTypeRpt.GetAll().ToList(); var dicList = _sysDicRpt.GetAll().ToList(); foreach (var hs in entity) { var ht = houseTypeList.FirstOrDefault(f => f.Id == hs.HouseType); if (ht != null) { hs.HouseTypeTxt = ht.TypeName; hs.HouseFee = ht.AllPrice; hs.PreFee = ht.PreReceiveFee; } var dic = dicList.FirstOrDefault(f => f.Id == hs.State); if (dic != null) { hs.StateTxt = dic.DicName; } } return(new OkObjectResult(entity.OrderBy(f => f.Code))); }
public async Task <IActionResult> Get() { IEnumerable <set_card_exchange> entityDto = null; await Task.Run(() => { entityDto = _setCardExchangeRpt.FindBy(f => f.IsValid); }); var entity = _mapper.Map <IEnumerable <set_card_exchange>, IEnumerable <SetCardExchangeDto> >(entityDto).ToList(); var houstTypeList = _setHouseTypeRepository.GetAll().ToList(); var serviceItemList = _yxServiceitemRepository.GetAll().ToList(); foreach (var hs in entity) { hs.HouseTypeTxt = houstTypeList.FirstOrDefault(f => f.Id == hs.HouseTypeId)?.TypeName; hs.ServiceItemTxt = serviceItemList.FirstOrDefault(f => f.Id == hs.ServiceItemId)?.Name; } return(new OkObjectResult(entity)); }
public async Task <IActionResult> Get(string type) { IEnumerable <yx_book> entityDto = null; await Task.Run(() => { if (type == "0") { entityDto = _yxBookRpt.FindBy(f => f.IsValid && f.Status == "取消"); } else if (type == "1") { entityDto = _yxBookRpt.FindBy(f => f.IsValid && f.Status != "取消"); } else { entityDto = _yxBookRpt.FindBy(f => f.IsValid); } }); var entity = _mapper.Map <IEnumerable <yx_book>, IEnumerable <BookingDto> >(entityDto).ToList(); var houseList = _setHouseTypeRepository.GetAll().ToList(); foreach (var hs in entity) { var dic = houseList.FirstOrDefault(f => f.Id == hs.HouseTypeId); if (dic != null) { hs.HouseTypeName = dic.TypeName; } } var dicList = _sysDicRepository.GetAll().ToList(); foreach (var hs in entity) { var dic = dicList.FirstOrDefault(f => f.Id == hs.CheckInType); if (dic != null) { hs.CheckInTypeTxt = dic.DicName; } } return(new OkObjectResult(entity)); }