public async Task <IActionResult> Delete(int?id) { if (id == null) { return(RedirectToAction(nameof(Error), new { message = "Id is null" })); } var obj = await _operatorService.FindByIdAsync(id.Value); if (obj == null) { return(RedirectToAction(nameof(Error), new { message = "Id not found" })); } return(View(obj)); }