public FlatCalculationsVm( FlatDataBm smallestFlat, FlatDataBm bigestFlat, FlatDataBm cheapestFlat, FlatDataBm mostExpensiveFlat ) { SmallestFlat = smallestFlat; BigestFlat = bigestFlat; CheapestFlat = cheapestFlat; MostExpensiveFlat = mostExpensiveFlat; }
private List <FlatDataBm> MapToFlatsBM(IEnumerable <Flat> allOffers) { var flatDataBMs = new List <FlatDataBm>(); foreach (var flat in allOffers) { var flatBM = new FlatDataBm( flat.Surface, flat.TotalPrice, flat.Rooms.HasValue ? (int)flat.Rooms : 0, flat.Url, flat.IsPrivate.HasValue ? flat.IsPrivate.Value : false); flatDataBMs.Add(flatBM); } return(flatDataBMs); }
protected override FlatDataBm ParseOffer(HtmlNode node) { var ogloszenieInfo = node.SelectSingleNode(@".//*[@class='ogloszenieInfo']"); FlatDataBm data; try { var Url = GetUrl(node); //var Location = GetLocation(ogloszenieInfo); var Rooms = GetRooms(ogloszenieInfo); var TotalPrice = GetPrice(node); var SquareMeters = GetSquareMeters(ogloszenieInfo); //var Year = GetYear(ogloszenieInfo); data = new FlatDataBm(SquareMeters, TotalPrice, Rooms, Url, false); } catch (Exception e) { Console.WriteLine($"Skipped: {ogloszenieInfo?.InnerHtml ?? "No inner HTML"} \n" + e); return(null); } return(data); }
protected override FlatDataBm ParseOffer(HtmlNode node) { Url = GetUrl(node, Errors); //var locationNode = node.SelectSingleNode(@".//article/p[1]"); var priceNode = node.SelectSingleNode(@".//article/p[2]"); var detailsNode = node.SelectSingleNode(@".//article/p[3]"); var bottomDetails = node.SelectSingleNode(@".//article/div[1]"); var otodomId = GetOtoDomId(Errors); var totalPrice = GetPrice(priceNode, Errors); var rooms = GetRooms(detailsNode, Errors); var squareMeters = GetArea(detailsNode, Errors); var isPrivate = IsPrivateOffer(bottomDetails, Errors); //var location = GetLocation(locationNode, Errors); var data = new FlatDataBm(squareMeters, totalPrice, rooms, Url, isPrivate) { OtoDomId = otodomId, //Location = location }; return(data); }