public ActionResult ShowProduct(string id, string idmh)
        {
            if (idmh == "DT000")
            {
                mvcSanPhamMatHangHSX item    = null;
                mvcTSDienThoai       item2   = null;
                mvcTSDongHo          item3   = null;
                HttpResponseMessage  reponse = GlobalVariables.WebApiClient.GetAsync("SanPhams/GetFindSanPhamMatHangHangSX/" + id).Result;

                HttpResponseMessage reponse1 = GlobalVariables.WebApiClient.GetAsync("TSDienThoais/GetFindIDSanPham/" + id).Result;
                item  = reponse.Content.ReadAsAsync <mvcSanPhamMatHangHSX>().Result;
                item2 = reponse1.Content.ReadAsAsync <mvcTSDienThoai>().Result;
                var objMultipleModels = Tuple.Create <mvcSanPhamMatHangHSX, mvcTSDienThoai, mvcTSDongHo>(
                    item, item2, item3
                    );
                return(View(objMultipleModels));
            }
            if (idmh == "ML000")
            {
                mvcSanPhamMatHangHSX item    = null;
                mvcTSDienThoai       item2   = null;
                mvcTSDongHo          item3   = null;
                HttpResponseMessage  reponse = GlobalVariables.WebApiClient.GetAsync("SanPhams/GetFindSanPhamMatHangHangSX/" + id).Result;

                HttpResponseMessage reponse1 = GlobalVariables.WebApiClient.GetAsync("TSDongHos/GetFindIDSanPham/" + id).Result;
                item  = reponse.Content.ReadAsAsync <mvcSanPhamMatHangHSX>().Result;
                item3 = reponse1.Content.ReadAsAsync <mvcTSDongHo>().Result;
                var objMultipleModels = Tuple.Create <mvcSanPhamMatHangHSX, mvcTSDienThoai, mvcTSDongHo>(
                    item, item2, item3
                    );
                return(View(objMultipleModels));
            }

            return(View());
        }
Пример #2
0
        public ActionResult ShowProduct(string id, string idmh)
        {
            mvcSanPhamMatHangHSX sp        = null;
            mvcTSDienThoai       item1     = null;
            mvcTSDongHo          item2     = null;
            HttpResponseMessage  reponseSP = GlobalVariables.WebApiClient.GetAsync("SanPhams/GetFindSanPhamMatHangHangSX/" + id).Result;

            HttpResponseMessage reponseDT = GlobalVariables.WebApiClient.GetAsync("TSDienThoais/GetTSSanPham/" + id).Result;
            HttpResponseMessage reponseDH = GlobalVariables.WebApiClient.GetAsync("TSDongHos/GetTSSanPham/" + id).Result;

            sp    = reponseSP.Content.ReadAsAsync <mvcSanPhamMatHangHSX>().Result;
            item1 = reponseDT.Content.ReadAsAsync <mvcTSDienThoai>().Result;
            item2 = reponseDH.Content.ReadAsAsync <mvcTSDongHo>().Result;
            var objMultipleModels = Tuple.Create <mvcSanPhamMatHangHSX, mvcTSDienThoai, mvcTSDongHo>(
                sp, item1, item2
                );

            return(View(objMultipleModels));
        }
Пример #3
0
        public IHttpActionResult GetFindSanPhamMatHangHangSX(string id)
        {
            mvcSanPhamMatHangHSX join = (from mh in db.matHangs
                                         join sp in db.sanPhams on mh.IDMH equals sp.IDMH
                                         join hsx in db.hangSXs on sp.IDHSX equals hsx.IDHSX
                                         where (sp.IDSP == id)
                                         select new mvcSanPhamMatHangHSX()
            {
                IDSP = sp.IDSP,
                TenSP = sp.TenSP,
                DonGia = sp.DonGia,
                Anh = sp.Anh,

                NgayCapNhat = sp.NgayCapNhat,
                IDMH = mh.IDMH,
                TenMH = mh.TenMH,
                IDHSX = hsx.IDHSX,
                TenHSX = hsx.TenHSX
            }).FirstOrDefault();;

            return(Ok(join));
        }