//public List<OnlineUserEntity> GetAllAbsentUsers(string userName, string macAndUser, string secretCode) //{ // List<OnlineUserEntity> _records = new List<OnlineUserEntity>(); // HttpResponseMessage response = _client.GetAsync($"OnlineUsers/AllAbsentUsers?userName={userName}&macAndUser={macAndUser}&secretCode={secretCode}").Result; // if (response.IsSuccessStatusCode) // { // var Data = response.Content.ReadAsStringAsync(); // List<OnlineUserEntity> categories = JsonConvert.DeserializeObject<List<OnlineUserEntity>>(Data.Result); // foreach (var entity in categories) // { // var ItemData = new OnlineUserEntity // { // Time = entity.Time, // userName = entity.userName, // //Timestamp = entity.Timestamp.ToLocalTime(), // }; // _records.Add(ItemData); // } // } // return _records; //} public string DeleteOnlineUser(string user, string macAndUser, string secretCode) { OnlineUserEntity Message = new OnlineUserEntity { PartitionKey = user, StoredMac = macAndUser, SecretCode = secretCode }; HttpContent content = new StringContent(JsonConvert.SerializeObject(Message)); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage response = _client.PostAsync($"OnlineUsers/Delete", content).Result; if (response.IsSuccessStatusCode) { var Data = response.Content.ReadAsStringAsync(); var res = Data.Result; return(res); } else { return("ErrorStatusCode: " + response.StatusCode); } }
public List <OnlineUserEntity> GetAllOnlineAndAbsentUsers(string userName, string macAndUser, string secretCode) { List <OnlineUserEntity> _records = new List <OnlineUserEntity>(); HttpResponseMessage response = _client.GetAsync($"OnlineUsers/AllOnlineAndAbsentUsers?userName={userName}&macAndUser={macAndUser}&secretCode={secretCode}").Result; if (response.IsSuccessStatusCode) { var Data = response.Content.ReadAsStringAsync(); List <OnlineUserEntity> categories = JsonConvert.DeserializeObject <List <OnlineUserEntity> >(Data.Result); foreach (var entity in categories) { var ItemData = new OnlineUserEntity { Time = entity.Time, userName = entity.userName, Status = entity.Status //Timestamp = entity.Timestamp.ToLocalTime(), }; _records.Add(ItemData); } } return(_records); }