//show specific product details
        public ActionResult ViewAd(int?id)
        {
            Adviewmodel ad = new Adviewmodel();
            product     p  = context.products.Where(x => x.pro_id == id).SingleOrDefault();

            ad.pro_id    = p.pro_id;
            ad.pro_name  = p.pro_name;
            ad.pro_image = p.pro_image;
            ad.pro_price = p.pro_price;
            ad.pro_des   = p.pro_description;
            category cat = context.categories.Where(x => x.cat_id == p.pro_fk_cat).SingleOrDefault();

            ad.cat_name = cat.cat_name;

            return(View(ad));
        }
Exemplo n.º 2
0
        public ActionResult ViewAd(int?id)
        {
            Adviewmodel ad = new Adviewmodel();
            tbl_product p  = db.tbl_product.Where(x => x.pro_id == id).SingleOrDefault();

            ad.pro_id    = p.pro_id;
            ad.pro_name  = p.pro_name;
            ad.pro_image = p.pro_image;
            ad.pro_price = p.pro_price;
            tbl_category cat = db.tbl_category.Where(x => x.cat_id == p.pro_fk_cat).SingleOrDefault();

            ad.cat_name = cat.cat_name;
            tbl_user u = db.tbl_user.Where(x => x.u_id == p.pro_fk_us).SingleOrDefault();

            ad.u_name    = u.u_name;
            ad.u_image   = u.u_image;
            ad.u_contact = u.u_contact;
            return(View(ad));
        }
Exemplo n.º 3
0
        public ActionResult ViewAd(int?id)
        {
            Adviewmodel ad = new Adviewmodel();
            tbl_product p  = db.tbl_product.Where(x => x.pro_id == id).SingleOrDefault();

            ad.pro_id    = p.pro_id;
            ad.pro_name  = p.pro_name;
            ad.pro_image = p.pro_image;
            ad.pro_price = p.pro_price;
            ad.pro_des   = p.pro_des;
            tbl_category cat = db.tbl_category.Where(x => x.cat_id == p.pro_fk_cat).SingleOrDefault();

            ad.cat_name = cat.cat_name;
            //tbl_user u = db.tbl_user.Where(x => x.u_id == p.pro_fk_user).SingleOrDefault();
            //ad.u_name = u.u_name;
            //ad.u_image = u.u_image;
            //ad.u_contact = u.u_contact;
            //ad.pro_fk_user = u.u_id;
            //tbl_comment com = db.tbl_comment.Where(x => x.comment_id == p.pro_fk_comment).SingleOrDefault();
            //ad.comment_content = com.comment_content;
            //tbl_rate ra = db.tbl_rate.Where(x => x.rate_id == p.pro_fk_rate).SingleOrDefault();
            //ad.rate_content = ra.rate_content;
            return(View(ad));
        }