public ViewResult Index()
 {
     msgListViewModel          = new MsgListViewModel();
     msgListViewModel.Users    = _userRepository.AllUsers;
     msgListViewModel.Comments = _commentsRepository.AllComments;
     return(View(msgListViewModel));
 }
        public ActionResult Index(string name, string message)
        {
            int likes = 0;

            cnn.Open();
            SqlCommand     command;
            SqlDataAdapter adapter = new SqlDataAdapter();

            String sql = "insert into [Users] values ('" + name + "', '" + likes + "', '" + message + "')";

            command = new SqlCommand(sql, cnn);
            adapter.InsertCommand = new SqlCommand(sql, cnn);
            adapter.InsertCommand.ExecuteNonQuery();
            command.Dispose();
            cnn.Close();

            msgListViewModel          = new MsgListViewModel();
            msgListViewModel.Users    = _userRepository.AllUsers;
            msgListViewModel.Comments = _commentsRepository.AllComments;
            return(View(msgListViewModel));
        }
        public ActionResult Comment(string cmtname, string comment, string extra)
        {
            int m_id  = int.Parse(extra);
            int likes = 0;

            cnn.Open();
            SqlCommand     command;
            SqlDataAdapter adapter = new SqlDataAdapter();

            String sql = "insert into [Comments] values ('" + comment + "', '" + likes + "', '" + m_id + "', '" + cmtname + "')";

            command = new SqlCommand(sql, cnn);
            adapter.InsertCommand = new SqlCommand(sql, cnn);
            adapter.InsertCommand.ExecuteNonQuery();
            command.Dispose();
            cnn.Close();

            msgListViewModel          = new MsgListViewModel();
            msgListViewModel.Users    = _userRepository.AllUsers;
            msgListViewModel.Comments = _commentsRepository.AllComments;
            return(View("Index", msgListViewModel));
        }