public async Task <IActionResult> FollowUser(string id) { FollowedUser u = new FollowedUser(); u.UserToFollow = id; u.FollowingUser = User.FindFirst(ClaimTypes.NameIdentifier).Value; _context.FollowedUsers.Add(u); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <IActionResult> CreatePost(string Content) { Post p = new Post(); p.Content = Content; p.Likes = 0; p.Poster = User.FindFirst(ClaimTypes.NameIdentifier).Value; p.Date = DateTime.Now; _context.Posts.Add(p); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); }