public Task <IActionResult> DeleteMatchDirector(ShooterMatchRequest request) { //Recupero l'elemento dal business layer var entity = BasicLayer.GetShooterMatch(request.ShooterMatchId); //Se l'utente non hai i permessi non posso rimuovere entità con userId nullo if (entity == null) { return(Task.FromResult <IActionResult>(NotFound())); } //Invocazione del service layer var validations = BasicLayer.DeleteShooterMatch(entity); if (validations.Count > 0) { return(BadRequestTask(validations)); } return(this.FetchAllMatchDirector(new MatchRequest { MatchId = entity.MatchId })); //var shooterMatches = BasicLayer.FetchShooterMatchesByMatchId(entity.MatchId); //var shooterIds = shooterMatches.Select(x => x.ShooterId).ToList(); //var shooters = BasicLayer.FetchShootersByIds(shooterIds); ////Return contract //return Reply(shooterMatches.As(x=> ContractUtils.GenerateContract(x,shooters.FirstOrDefault(s=> s.Id == x.ShooterId)))); }