public ViewResult Story(string thestory, string username, string email, string title, bool ismember) { Story tale = new Story(); tale.IsMember = ismember; tale.Title = title; tale.TheStory = thestory; tale.Username = username; tale.Email = email; tale.Date = DateTime.Now; User user1 = new User(); user1.IsMember = ismember; user1.UserName = username; user1.EMAIL = email; StoryRepository.AddStory(tale); StoryRepository.AddUser(user1); ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); return(View("StoryPage", StoryRepository.Stories)); }
public ViewResult StoryPage() { StoryRepository.storyList.Sort((s1, s2) => DateTime.Compare(s1.Date, s2.Date)); //Sort the stories by date on the page when it's called. ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); return(View("StoryPage", StoryRepository.Stories)); }
public ViewResult UserList(string username) { User Username = new User(); StoryRepository.AddUser(Username); ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); return(View("UserList", StoryRepository.UserNames)); }
public IActionResult NewComment(string title, string commentText, string username) { Comment comment = new Comment(); comment.StoryTitle = title; comment.CommentText = commentText; comment.Username = username; comment.Date = DateTime.Now; User user1 = new User(); user1.UserName = username; //Adds user that is posting a comment to the user list. for (int i = 0; i < StoryRepository.usersList.Count; i++) //for loop checks to see if the user is already apart of the userList, and if not then it adds a default email. { if (StoryRepository.usersList[i] != user1) { user1.EMAIL = null; } } StoryRepository.AddUser(user1); ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); if (ModelState.IsValid) //check if I need this { Story story = stories.GetStoryByTitle(title); stories.AddComment(story, comment, username); return(RedirectToAction("StoryPage")); } else { return(RedirectToAction("NewComment", comment.StoryTitle)); } }
public IActionResult NewComment(string title) { ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); return(View("NewComment", HttpUtility.HtmlDecode(title))); }
public ViewResult UserList() { ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); return(View(StoryRepository.UserNames)); }
public ViewResult Story() { ViewBag.storyCount = StoryRepository.GetStoryCount(); ViewBag.userCount = StoryRepository.GetUserCount(); return(View("Story")); }