Ejemplo n.º 1
0
        public IActionResult AddPost(string Content)
        {
            Post post = new Post()
            {
                Content   = Content,
                User      = UserManager.GetUserAsync(HttpContext.User).Result,
                Timestamp = DateTime.Now,
                Deleted   = false
            };

            userHomeService.AddUserPost(post);
            return(PartialView("GetAll", userHomeService.GetAllPosts()));
        }
Ejemplo n.º 2
0
        public IActionResult AddPost(string Content)
        {
            string CurrentUserID = user.GetUserAsync(HttpContext.User).Result.Id;

            ViewBag.CurrentUserID = CurrentUserID;

            Post post = new Post()
            {
                Content   = Content,
                UserID    = user.GetUserAsync(HttpContext.User).Result.Id,
                Timestamp = DateTime.Now,
                Deleted   = false
            };

            userHomeService.AddUserPost(post);
            return(PartialView("GetAll", service.GetAllUserPosts(CurrentUserID)));
        }