public async Task <ObjectResult> FullInformation(string id) { WebReq req = new WebReq(); UserList dBUserItemsDBFind = JsonConvert.DeserializeObject <UserList>(System.IO.File.ReadAllText(path)); Commands comm = new Commands(); comm.DBCheck(comm, dBUserItemsDBFind, id); if (comm.Exist == false) { Response.StatusCode = 404; return(new ObjectResult(null)); } if (dBUserItemsDBFind == null) { Response.StatusCode = 404; } string real = dBUserItemsDBFind.users[comm.Index].Real; //List<string> cryptos = new List<string>(); UserShow userShow = await req.GetTickers(dBUserItemsDBFind, comm.Index, real); return(new ObjectResult(userShow.Ticker)); }
public async Task <ObjectResult> Information(string id, string cryptoname) { WebReq req = new WebReq(); UserList dBUserItemsDBFind = JsonConvert.DeserializeObject <UserList>(System.IO.File.ReadAllText(path)); Commands comm = new Commands(); comm.DBCheck(comm, dBUserItemsDBFind, id); if (comm.Exist == false) { Response.StatusCode = 404; return(new ObjectResult(null)); } if (dBUserItemsDBFind == null) { Response.StatusCode = 404; } client = new CoinpaprikaAPI.Client(); var coins = await client.GetCoinsAsync(); string s = JsonConvert.SerializeObject(coins); Value st = JsonConvert.DeserializeObject <Value>(s); Dictionary <string, string> names = new Dictionary <string, string>(); int lenght = st.value.Count; for (int i = 0; i < lenght; i++) { st.value[i].Name = st.value[i].Name.ToLower(); names.Add(st.value[i].Id, st.value[i].Name); } string temp2 = names.FirstOrDefault(x => x.Value == cryptoname).Key; if (temp2 == null) { Response.StatusCode = 404; return(new ObjectResult(null)); } string real = dBUserItemsDBFind.users[comm.Index].Real; List <string> cryptos = new List <string>(); UserShow userShow = await req.GetTickers(dBUserItemsDBFind, comm.Index, real); int cryind = 0; bool exist = false; for (int i = 0; i < userShow.Ticker.Count; i++) { string t = userShow.Ticker[i].Name.ToLower(); if (t == cryptoname) { cryind = i; exist = true; } } if (exist == true) { return(new ObjectResult(userShow.Ticker[cryind])); } else { Response.StatusCode = 404; return(new ObjectResult(null)); } }