Esempio n. 1
0
        /// <summary>
        /// Initializes the field for client use.
        /// </summary>
        /// <param name="api">The current api</param>
        public virtual void Init(IApi api)
        {
            if (Id.HasValue)
            {
                Page = api.Pages.GetById(Id.Value);

                if (Page == null)
                {
                    // The page has been removed, remove the
                    // missing id.
                    Id = null;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the field for client use.
        /// </summary>
        /// <param name="api">The current api</param>
        public virtual async Task Init(IApi api)
        {
            if (Id.HasValue)
            {
                Page = await api.Pages
                       .GetByIdAsync(Id.Value)
                       .ConfigureAwait(false);

                if (Page == null)
                {
                    // The page has been removed, remove the
                    // missing id.
                    Id = null;
                }
            }
        }