Example #1
0
        /// <summary>
        /// Request residential object from designation.
        /// </summary>
        /// <param name="bagObject">Entity to extend.</param>
        /// <param name="bag">BAG registrar.</param>
        /// <returns><see cref="BagObject{ResidentialObject}"/>.</returns>
        public static BagObject <ResidentialObject> ResidentialObject(this BagObject <Designation> bagObject, KadasterBag bag)
        {
            if (bagObject == null)
            {
                throw new ArgumentNullException(nameof(bagObject));
            }

            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            var residentialObjectService = bag.ResidentialObjectService();
            var uri = bagObject.Value.Links.AddressObject.Href;

            switch (uri.Segments[3].Replace("/", null).Trim().ToLower())
            {
            case "verblijfsobjecten":
                var id = uri.Segments[4];     // TODO: This may not always be true;
                return(residentialObjectService.GetById(new BagId(id)));

            default:
                break;
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Request residential object from premise.
        /// </summary>
        /// <param name="bagObject">Entity to extend.</param>
        /// <param name="bag">BAG registrar.</param>
        /// <returns><see cref="BagObject{ResidentialObject}"/>.</returns>
        public static BagObject <ResidentialObject> ResidentialObject(this BagObject <Premise> bagObject, KadasterBag bag)
        {
            if (bagObject == null)
            {
                throw new ArgumentNullException(nameof(bagObject));
            }

            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            var residentialObjectService = bag.ResidentialObjectService();
            var uri = bagObject.Value.Links.ResidentialObject.Href;
            var id  = uri.Segments[4]; // TODO: This may not always be true;

            return(residentialObjectService.GetById(new BagId(id)));
        }