public async Task <IActionResult> Detail(int id) { ViewData["TotalTime"] = 0; var result = await _taskFactory.GetObject($"api/task/{id}"); if (result != null) { var project = await _projectFactory.GetObject($"api/project/{result.ProjectID}"); if (project != null) { ViewData["Project"] = project.Name; } var times = await _timeFactory.GetObjects($"api/time/task/{id}"); if (times != null) { ViewData["Times"] = times; var totalTime = (decimal)times.Sum(x => x.TotalTime); ViewData["TotalTime"] = decimal.Round(totalTime, 2, MidpointRounding.AwayFromZero); } } return(View(result)); }
public async Task <IActionResult> Edit(int id) { var item = await _projectFactory.GetObject($"api/project/{id}"); return(View(item)); }