public async Task <HQEmployee> GetEmployee(int employeeId) { string url = this.BuildUrl("/api/employees/" + employeeId); string json = await commonRequestOperation(url); // deserialize the json response into C# objects HQEmployee result = Newtonsoft.Json.JsonConvert.DeserializeObject < HQEmployee>(json); return(result); }
public Employee(HQEmployee e) { this.Name = e.Name; this.Email = e.Email; // do not preserve this, we'll add our own this.EmployeeId = -1; this.IsManager = e.IsManager; if (e.DateOfBirth != null) { this.DateOfBirth = DateTime.Parse(e.DateOfBirth); } }
public async Task <HQEmployee> GetEmployee(int employeeId) { string url = this.BuildUrl("/api/employees/" + employeeId); var response = await commonRequestOperation(url); if (response.StatusCode == HttpStatusCode.NotFound) { return(null); } string json = await response.Content.ReadAsStringAsync(); // deserialize the json response into C# objects HQEmployee result = Newtonsoft.Json.JsonConvert.DeserializeObject < HQEmployee>(json); return(result); }