public async Task <IActionResult> Get() { IEnumerable <yx_book> entityDto = null; await Task.Run(() => { entityDto = _yxBookRpt.FindBy(f => f.IsValid); }); return(new OkObjectResult(entityDto)); }
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)); }