Esempio n. 1
0
        public MyBlogList()
        {
            this.InitializeComponent();
            _navigationHelper = new NavigationHelper(this);

            MyBlogModel = new MyBlogViewModel();

            SizeChanged += OnSizeChanged;
        }
Esempio n. 2
0
        public MyBlogDetail()
        {
            this.InitializeComponent();
            _navigationHelper = new NavigationHelper(this);

            MyBlogModel = new MyBlogViewModel();

            ApplicationView.GetForCurrentView().
            SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible);
        }
Esempio n. 3
0
        public ActionResult MyBlog(string tab = Constant.Blog.String.MyArticleTab
                                   , int page = 0, string view = Constant.Blog.String.ListView)
        {
            int            skip     = page * Constant.Blog.Integer.PagingDefaultTake;
            List <Article> articles = bService.GetArticles(tab, skip, User.Identity.GetUserId <int>());


            ICollection <ArticlePreviewViewModel> articlePreviewVMs =
                articles.Select(Mapper.Map <Article, ArticlePreviewViewModel>)    // Using Mapper with Collection
                .ToList();

            for (int i = 0; i < articlePreviewVMs.Count; i++)
            {
                articlePreviewVMs.ElementAt(i).UserInfo.CreateMainPostDate = articlePreviewVMs.ElementAt(i).PublicDate.Value;
                if (Request.IsAuthenticated)
                {
                    articlePreviewVMs.ElementAt(i).Bookmarked =
                        articlePreviewVMs.ElementAt(i).UserId != User.Identity.GetUserId <int>() &&
                        articles.ElementAt(i).BookmarkUsers
                        .Where(u => u.Id == User.Identity.GetUserId <int>()).Count() > 0;
                }
            }

            if (page == 0)
            {
                MyBlogViewModel myBlogVM = new MyBlogViewModel();
                ViewBag.Tab       = tab;
                ViewBag.System    = Constant.String.BlogSystem;
                myBlogVM.Articles = articlePreviewVMs;
                myBlogVM.View     = view;
                //myBlogVM.Url = Request.Url.PathAndQuery;
                return(View("Views/MyBlogView", myBlogVM));
            }
            else
            {
                if (view == Constant.Blog.String.ListView)
                {
                    return(PartialView("Partials/_ArticleListPartialView", articlePreviewVMs));
                }
                else
                {
                    return(PartialView("Partials/_ArticleGridPartialView", articlePreviewVMs));
                }
            }
        }