public async Task <IActionResult> Index() { var result = await _clientHelper.GetClient <IEnumerable <Employee> >("/api/Employees", null, ClaimsHelper.GetJwtToken(User)); if (result == null) { ModelState.AddModelError("error", "Unable to retrieve record."); return(View(new List <Employee>())); } if (result.StatusCode == System.Net.HttpStatusCode.OK) { return(View(result.Entity)); } else { return(View(new List <Employee>())); } }
public async Task <IActionResult> Index() { var result = await _clientHelper.GetClient <IEnumerable <TimeRecordViewModel> >("/api/TimeRecords", null, ClaimsHelper.GetJwtToken(User)); if (result == null) { ModelState.AddModelError("error", "Unable to retrieve record."); return(View(new List <TimeRecord>())); } if (result.StatusCode == System.Net.HttpStatusCode.OK) { result.Entity = result.Entity.OrderBy(o => o.StartDateTime).ToList(); return(View(result.Entity)); } else { return(View(new List <TimeRecord>())); } }