public async Task <IActionResult> UpdateShooterTeamPayment([EntityId] ShooterTeamPaymentUpdateRequest request)
        {
            //Recupero l'elemento dal business layer
            var entity = BasicLayer.GetShooterTeamPayment(request.ShooterTeamPaymentId);

            //modifica solo se admin o se utente richiedente è lo stesso che ha creato
            if (entity == null)
            {
                return(NotFound());
            }

            //Aggiornamento dell'entità
            entity.TeamId           = request.TeamId;
            entity.ShooterId        = request.ShooterId;
            entity.Amount           = request.Amount;
            entity.Reason           = request.Reason;
            entity.PaymentDateTime  = request.PaymentDateTime;
            entity.ExpireDateTime   = request.ExpireDateTime;
            entity.NotifyExpiration = request.NotifyExpiration;

            //Salvataggio
            var validations = await BasicLayer.UpdateShooterTeamPayment(entity, PlatformUtils.GetIdentityUserId(User));

            if (validations.Count > 0)
            {
                return(BadRequest(validations));
            }

            //Confermo
            return(Ok(ContractUtils.GenerateContract(entity)));
        }
        public async Task ShouldUpdateShooterTeamPaymentBeOkHavingProvidedData()
        {
            var existing = Scenario.ShooterTeamPayments.FirstOrDefault();

            if (existing == null)
            {
                Assert.Inconclusive("No shooter team payment exists");
            }
            //Conteggio gli elementi prima della creazione
            var countBefore = Scenario.ShooterTeamPayments.Count;


            //Composizione della request
            var request = new ShooterTeamPaymentUpdateRequest
            {
                ShooterTeamPaymentId = existing.Id,
                TeamId          = existing.TeamId,
                ShooterId       = existing.ShooterId,
                Reason          = RandomizationUtils.GenerateRandomString(5),
                Amount          = 1,
                PaymentDateTime = existing.PaymentDateTime
            };

            //Invoke del metodo
            var response = await Controller.UpdateShooterTeamPayment(request);

            //Conteggio gli elementi dopo la creazione
            var countAfter = Scenario.ShooterTeamPayments.Count;

            //Parsing della risposta e assert
            var parsed = ParseExpectedOk <ShooterTeamPaymentContract>(response);

            var updatedEntity = Scenario.ShooterTeamPayments.FirstOrDefault(x => x.Id == parsed.Data.ShooterTeamPaymentId);

            Assert.IsNotNull(parsed);
            Assert.AreEqual(countAfter, countBefore);
            Assert.IsTrue(updatedEntity.TeamId == request.TeamId &&
                          updatedEntity.ShooterId == request.ShooterId &&
                          updatedEntity.Reason == request.Reason &&
                          updatedEntity.PaymentDateTime == request.PaymentDateTime &&
                          updatedEntity.Amount == request.Amount &&
                          updatedEntity.ExpireDateTime == request.ExpireDateTime &&
                          updatedEntity.NotifyExpiration == request.NotifyExpiration
                          );
        }