public async Task <IActionResult> DeleteExperienceAsync(int id) { Experience experience = await _context.Experiences.FindAsync(id); Dictionary <string, string> errors = new Dictionary <string, string>(); if (experience != null) { if (experience.CanBeDeleted(_context, errors)) { _context.Experiences.Remove(experience); await _context.SaveChangesAsync(); return(NoContent()); } else { return(BadRequest(errors)); } } return(NotFound()); }