public MenuState ExecuteCommand(int index) { switch ((Command)index) { case Command.Write: TextArea.Write(); Reply.Content = TextArea.Lines.ToList(); return(MenuState.AddReply); case Command.Submit: var replyAdded = PostService.TrySaveReply(Reply, PostView.PostId); if (!replyAdded) { Error = true; return(MenuState.Rerender); } return(MenuState.ReplyAdded); case Command.Back: ForumViewEngine.ResetBuffer(); return(MenuState.Back); } throw new InvalidCommandException(); }
public MenuState ExecuteCommand(int index) { switch ((Command)index) { case Command.Write: this.TextArea.Write(); this.Reply.Content = this.TextArea .Lines.ToList(); return(MenuState.AddReply); case Command.Submit: bool isReplyAdded = PostService.TryAddReply(this.Post.PostId, this.Reply); if (!isReplyAdded) { this.Error = true; return(MenuState.Rerender); } return(MenuState.ReplyAdded); case Command.Back: ForumViewEngine.ResetBuffer(); return(MenuState.Back); } throw new InvalidCommandException(); }
public MenuState ExecuteCommand(int index) { switch ((Command)index) { case Command.Back: ForumViewEngine.ResetBuffer(); return(MenuState.Back); case Command.AddReply: return(MenuState.AddReplyToPost); } throw new InvalidCommandException(); }