public async Task <IActionResult> Edit(Guid id, [Bind("Id, Action, ActionName, IsCompleted, DeviceName")] Code code) { if (id != code.Id) { return(NotFound()); } if (!ModelState.IsValid) { return(View(code)); } try { await _repository.UpdateAsync(id, code); } catch (DbUpdateConcurrencyException) { if (!await _repository.ContainsAsync(code.Id)) { return(NotFound()); } throw; } Guid deviceId = await GetDeviceIdAsync(id); return(RedirectToAction(nameof(Index), new { deviceId })); }