Example #1
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);

            this.postDS = e.Parameter as PostDataSource;
            this.LoadData();
        }
 public SelfPostsController(PostDataSource pds, UserDataSource uds,
                            ImageProcessingService imgSrv, AzureStorage stSrv)
 {
     _postDataSource = pds ?? throw new ArgumentNullException(nameof(pds));
     _userDataSource = uds ?? throw new ArgumentNullException(nameof(uds));
     _imageService   = imgSrv ?? throw new ArgumentNullException(nameof(imgSrv));
     _storageService = stSrv ?? throw new ArgumentNullException(nameof(stSrv));
 }
 public static string Index()
 {
     return(View(nameof(PostsController), nameof(Index), PostDataSource.GetPosts()));
 }
        public static string Details(int id)
        {
            var post = PostDataSource.GetPosts().FirstOrDefault(p => p.Id == id);

            return(View(nameof(PostsController), nameof(Details), post));
        }
 public PostsController(PostDataSource pds, UserDataSource uds)
 {
     _postDataSource = pds ?? throw new ArgumentNullException(nameof(pds));
     _userDataSource = uds ?? throw new ArgumentNullException(nameof(uds));
 }
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);

            this.postDS = e.Parameter as PostDataSource;
            this.LoadData();
        }