public async Task <IActionResult> CompleteCode([FromBody] TimeDevice timeDevice) //TODO: Complete & Fix. { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Code latest = await GetLatestCode(timeDevice.deviceId, false); if (latest == null) { return(NotFound()); } await _repository.CompleteAsync(latest, timeDevice.dateTime); await _hubContext.Clients.Group(GetUserName()).InvokeAsync("codeDone", latest.Device.Name, string.IsNullOrWhiteSpace(latest.ActionName) ? latest.Action.ToString() : latest.ActionName); return(Ok()); }