//Return values of Schedule in page public IActionResult Delete(int?id) { //Test if id is null if (id == null) { return(NotFound()); } //Load object for delete var obj = _scheduleService.FindById(id.Value); //Testif id exists if (obj == null) { return(NotFound()); } return(View(obj)); }