Exemplo n.º 1
0
        public IActionResult CreditToken(CreditTokenViewModel vmCreditToken)
        {
            if (!Authorized(Role.Volunteer))
            {
                return(Unauthorized());
            }

            AdherentStolon adherentStolon = _context.AdherentStolons.Include(x => x.Adherent).First(x => x.Id == vmCreditToken.AdherentStolon.Id);

            adherentStolon.Token += vmCreditToken.CreditedToken;
            _context.Add(new AdherentTransaction(
                             adherentStolon.Adherent,
                             adherentStolon.Stolon,
                             Transaction.TransactionType.Inbound,
                             Transaction.TransactionCategory.TokenCredit,
                             vmCreditToken.CreditedToken,
                             "Encaissement de " + vmCreditToken.CreditedToken + "€, pour créditage du compte de " + adherentStolon.Adherent.Name + "( " + adherentStolon.LocalId + " ) de " + vmCreditToken.CreditedToken + "Ṩ"));
            _context.Update(adherentStolon);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public IActionResult CreditToken(CreditTokenViewModel vmCreditToken)
 {
     Consumer consumer = _context.Consumers.Single(m => m.Id == vmCreditToken.Consumer.Id);
     consumer.Token += vmCreditToken.CreditedToken;
     _context.Add(new Transaction(
         Transaction.TransactionType.Inbound,
         Transaction.TransactionCategory.TokenCredit,
         vmCreditToken.CreditedToken,
         "Créditage du compte de "+ consumer.Name + "( " + consumer.Id + " ) de "  + vmCreditToken.CreditedToken + "??"));
     _context.Update(consumer);
     _context.SaveChanges();
     return RedirectToAction("Index");
 }