public async Task <ActionResult <Squad> > DeleteSquad(int Id) { try { var squadToDelete = await _squadRepository.GetSquadAsync(Id); if (squadToDelete == null) { return(NotFound($"User with Id={Id} not found")); } _mapper.Map <SquadDeleteDto>(squadToDelete); return(await _squadRepository.DelateSquadAsync(Id)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Erorr deleting data")); } }