private void FillReasonsIfItIsNecessary(ReviewTravelFeeling feeling) { foreach (ReviewTravelFeelingReason reason in feeling.ReviewTravelFeelingReasons) { if (String.IsNullOrEmpty(reason.Description)) { TravelFeelingReason existingReason = this._travelFeelingService.GetTravelFeelingReasonById(feeling.FeelingId, reason.ReasonId); reason.Description = existingReason.Description; } } }
public TravelFeelingReason GetTravelFeelingReasonById(int travelFeelingId, int reasonId) { TravelFeelingReason reason = null; IList <TravelFeelingReasonsPerFeelingAndTransportType> relations = this._relationsRepository.GetAllByConditions(x => x.TravelFeelingId == travelFeelingId && x.TravelFeelingReasonId == reasonId); if (relations.Count > 0) { IList <int> reasonsIds = relations.Select(x => x.TravelFeelingReasonId).ToList(); reason = this._reasonRepository.GetFirstByConditions(x => reasonsIds.Contains(x.ReasonId)); } if (reason == null) { throw new ObjectNotFoundException(); } return(reason); }