public GetRateTypeResponseDto GetRateTypeByProperty(int propertyId) { if (propertyId <= 0) { throw new PmsException("Property id is not valid."); } var response = new GetRateTypeResponseDto(); if (!AppConfigReaderHelper.AppConfigToBool(AppSettingKeys.MockEnabled)) { response.RateTypes = _iPmsLogic.GetRateTypeByProperty(propertyId); } else { //mock data response.RateTypes = new List <Resources.Entities.RateType> { new PmsEntity.RateType { Id = 1, Name = "Apartment Standard Test" }, new PmsEntity.RateType { Id = 2, Name = "Apartment Standard" }, new PmsEntity.RateType { Id = 3, Name = "Queen Standard" }, new PmsEntity.RateType { Id = 4, Name = "Holiday Standard" }, new PmsEntity.RateType { Id = 5, Name = "My Weekend Standard" } }; } return(response); }
public GetRateTypeResponseDto GetRateTypeById(int propertyId, int typeId) { if (propertyId <= 0) { throw new PmsException("Property id is not valid."); } var response = new GetRateTypeResponseDto(); if (typeId <= 0) { return(response); } var rateTypeResponseDto = GetRateTypeByProperty(propertyId); if (rateTypeResponseDto == null || rateTypeResponseDto.RateTypes == null || rateTypeResponseDto.RateTypes.Count <= 0) { return(response); } response.RateTypes = rateTypeResponseDto.RateTypes.Where(x => x.Id.Equals(typeId)).ToList(); return(response); }