Пример #1
0
        public ActionResult Jabb()
        {
            string email = Session["email"].ToString();
            string Photo = Session["Photo"].ToString();

            MySqlConnection con    = new MySqlConnection("host=localhost;user=Lancher;password=123456;database=lancherdb");
            string          strSQL = "SELECT post.* , posting.EmailID , posting.PostID FROM posting inner join user on posting.EmailID = user.EmailID inner join post on posting.PostID = post.PostID WHERE posting.EmailID = '" + email + "' ";

            con.Open();
            MySqlCommand    cmd       = new MySqlCommand(strSQL, con);
            var             model     = new List <ThreeTableViewModel>();
            string          keepphoto = Session["Photo"].ToString();
            MySqlDataReader dr        = cmd.ExecuteReader();

            ViewBag.showImag = keepphoto;

            try
            {
                while (dr.Read())
                {
                    var Threepost_m = new ThreeTableViewModel();
                    Threepost_m.PostID       = dr.GetString(0);
                    Threepost_m.Title        = dr.GetString(1);
                    Threepost_m.PostDescrip  = dr.GetString(2);
                    Threepost_m.PostMany     = dr.GetString(3);
                    Threepost_m.TypePost     = dr.GetString(4);
                    Threepost_m.PostMoney    = dr.GetString(5);
                    Threepost_m.DeadlinePost = Convert.ToDateTime(dr.GetString(6));
                    Threepost_m.PostEmailID  = dr.GetString(7);

                    ViewBag.showImag = keepphoto;

                    model.Add(Threepost_m);
                }
            }
            catch { }


            return(View(model));
        }
Пример #2
0
        // GET: join

        public ActionResult join()
        {
            string idpost = Session["111"].ToString();

            MySqlConnection con    = new MySqlConnection("host=localhost;user=Lancher;password=123456;database=lancherdb");
            string          strSQL = "SELECT post.* , posting.EmailID , posting.PostID FROM posting inner join user on posting.EmailID = user.EmailID inner join post on posting.PostID = post.PostID WHERE posting.PostID = '" + idpost + "'";

            con.Open();
            MySqlCommand cmd = new MySqlCommand(strSQL, con);

            var model = new List <ThreeTableViewModel>();

            MySqlDataReader dr = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    var post_m = new ThreeTableViewModel();

                    post_m.PostID = dr.GetString(0);


                    post_m.EmailID = dr["EmailID"].ToString();

                    model.Add(post_m);
                    //model1.Add(three);
                }
                return(View(model));
            }
            catch
            {
            }

            return(View(model));
        }