Exemplo n.º 1
0
        public ActionResult VerMP(int id)
        {
            ViewBag.Message    = "Inbox";
            Session["UserIDG"] = Session["UserIDG"];
            Session["UserID"]  = Session["UserID"];
            Session["User"]    = Session["User"];
            MP mp = new MP();

            mp = mp.getMPByID(id);
            User user = new User();

            user = user.getUserID(mp.id_from);
            List <string> items = new List <string>();

            items.Add(mp.title);
            items.Add(mp.date_send);
            items.Add(mp.msg);
            items.Add(user.name);
            ViewBag.Items = items;
            if (mp.check.Equals(1))
            {
                return(View());
            }
            String sql     = "Update  MP set check_read = '1' where id_message = '" + id + "'";
            int    retorno = 0;

            using (SqlConnection connection = BD.getConnection())
            {
                SqlCommand Comando = new SqlCommand(string.Format(sql), connection);
                retorno = Comando.ExecuteNonQuery();
                connection.Close();
            }
            return(View());
        }