Пример #1
0
        public async Task <IActionResult> GetTransfer([FromQuery] QueryViewModel q)
        {
            var         data   = JsonConvert.SerializeObject(q);
            ResultModel result = new ResultModel();

            string targetUri = _config["api"] + "/Transfer";

            targetUri += q.GenerateQueryString();

            result = await _callApi.CallAPI(null, new Uri(targetUri), "GET");

            //result = await CallAPI(null, new Uri(targetUri), "GET");
            if (result.IsSuccess == true && result.Data != null)
            {
                q.TransferRecords = JsonConvert.DeserializeObject <List <TransferRecord> >(result.Data.ToString());
            }
            if (result.Message == "Unauthorized or token exppired.")
            {
                return(RedirectToAction("Login", "User"));
            }
            if (TempData["IsSuccess"] == null)
            {
                TempData["IsSuccess"] = result.IsSuccess;
                TempData["msg"]       = result.Message;
            }

            return(View(q));
        }
Пример #2
0
        public async Task <IActionResult> GetFriend(QueryViewModel model)
        {
            ResultModel result  = new ResultModel();
            string      address = _config["api"] + "/Friends";

            address += model.GenerateQueryString();

            result = await _callApi.CallAPI(null, new Uri(address), "GET");

            if (result.IsSuccess == true && result.Data != null)
            {
                model.Friends = JsonConvert.DeserializeObject <List <Friend> >(result.Data.ToString());
            }
            if (TempData["IsSuccess"] == null)
            {
                TempData["IsSuccess"] = result.IsSuccess;
                TempData["msg"]       = result.Message;
            }
            return(View(model));
        }