public async Task <IActionResult> DeletePerson(long id) { _logger.LogInformation($"api/v1/person DELET request at {DateTime.Now:hh:mm:ss}"); try { var person = await _context.Persons.Include(p => p.Skills).FirstOrDefaultAsync(x => x.Id == id); if (person == null) { _logger.LogError($"Not found person {id}"); return(NotFound($"Not found Person {id}")); } _context.RemoveRange(person.Skills); _context.Persons.Remove(person); await _context.SaveChangesAsync(); return(Ok($"Person {id} has been deleted")); } catch (Exception e) { _logger.LogError(e.Message); return(BadRequest(e.Message)); } }