public ApartmentsGroup(IEnumerable <ApartmentInfo> apartments) { if (apartments == null) { throw new ArgumentNullException(nameof(apartments)); } var apartmentList = new List <ApartmentInfo>(apartments); if (apartmentList.Count == 0) { throw new ArgumentOutOfRangeException(nameof(apartments)); } Title = GetGroupTitle(apartmentList); Location = CoreModelsHelper.GetPointsRect(apartmentList.Select(x => x.Location).ToArray()).LocationMiddle; HasNewest = apartmentList.Any(x => x.IsNewest()); AllIsOld = apartmentList.All(x => x.IsOld()); Apartments = apartmentList; }
public Region(int id, string name, string colorHex, IEnumerable <PointLatLng> locations) { if (locations == null) { throw new ArgumentNullException(nameof(locations)); } _locations = locations.ToArray(); if (_locations.Length == 0) { throw new ArgumentOutOfRangeException(nameof(locations)); } _rect = CoreModelsHelper.GetPointsRect(_locations); Id = id; Name = name; ColorHex = colorHex; Center = _rect.LocationMiddle; }