示例#1
0
        public IActionResult Index()
        {
            var res = userHomeService.GetAllPosts();

            ViewBag.posts = res;
            return(View());
        }
        public IActionResult Index()
        {
            string CurrentUserID = UserManager.GetUserAsync(HttpContext.User).Result.Id;

            var res = userHomeService.GetAllPosts(UserManager.GetUserAsync(HttpContext.User).Result.Id);

            ViewBag.posts               = res;
            ViewBag.CurrentUserID       = UserManager.GetUserAsync(HttpContext.User).Result.Id;
            ViewBag.CurrentUserUserName = userHomeService.GetUserName(CurrentUserID);


            return(View());
        }
        public IActionResult DeletePost(int postid)
        {
            string CurrentUserID = user.GetUserAsync(HttpContext.User).Result.Id;

            ViewBag.CurrentUserID = CurrentUserID;

            userHomeService.DeletePost(postid);
            return(PartialView("GetAll", userHomeService.GetAllPosts(CurrentUserID)));
        }