コード例 #1
0
        public async Task <IActionResult> EditShop(int id)
        {
            string     route    = $"api/Shop/{id}";
            UriBuilder endPoint = new UriBuilder(Api);

            endPoint.Path = route;

            ShopModel shopModel = (await MvcHttpClient <ShopModel, dynamic> .GetAsync(endPoint.Uri)).Value;

            return(View(shopModel));
        }
コード例 #2
0
        private async Task <ActionResult <ItemModel> > GetProductInformation(int id)
        {
            string route    = $"api/Product/GetItem/{id}";
            var    endPoint = new UriBuilder(Api);

            endPoint.Path = route;

            try
            {
                ItemModel item = (await MvcHttpClient <ItemModel, dynamic> .GetAsync(endPoint.Uri)).Value;
                return(item);
            }
            catch (Exception ex)
            {
                return(new ItemModel());
            }
        }
コード例 #3
0
        //useless for now
        public async Task <IActionResult> Index(int id)
        {
            string     route    = $"api/Shop/{id}";
            UriBuilder endPoint = new UriBuilder(Api);

            endPoint.Path = route;

            ShopModel shopModel = (await MvcHttpClient <ShopModel, dynamic> .GetAsync(endPoint.Uri)).Value;

            if (shopModel != null)
            {
                return(View(shopModel));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #4
0
        public async Task <IActionResult> Product(int id)
        {
            string route    = $"api/Product/GetItem/{id}";
            var    endPoint = new UriBuilder(Api);

            endPoint.Path = route;

            ItemModel item = (await MvcHttpClient <ItemModel, dynamic> .GetAsync(endPoint.Uri)).Value;

            if (item != null)
            {
                return(View(item));
            }
            else
            {
                return(NotFound());
            }
        }