Exemple #1
0
        /// <summary>
        /// PaySympathiserSubscription
        /// </summary>
        /// <param name="id">Sympathizer ID</param>
        /// <returns></returns>
        public IActionResult PaySympathiserSubscription(Guid id)
        {
            if (!Authorized(Role.Volunteer))
            {
                return(Unauthorized());
            }

            Transaction transaction   = new Transaction();
            Sympathizer sympathizer   = _context.Sympathizers.FirstOrDefault(x => x.Id == id);
            Stolon      currentStolon = GetCurrentStolon();

            sympathizer.SubscriptionPaid = true;
            transaction.Amount           = currentStolon.SympathizerSubscription;
            //Add a transaction
            transaction.Stolon           = currentStolon;
            transaction.AddedAutomaticly = true;
            transaction.Date             = DateTime.Now;
            transaction.Type             = Transaction.TransactionType.Inbound;
            transaction.Category         = Transaction.TransactionCategory.Subscription;
            transaction.Description      = "Paiement de la cotisation du sympathisant : " + sympathizer.Name + " " + sympathizer.Surname;
            _context.Transactions.Add(transaction);
            //Save
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public IActionResult DeleteSympathizer(Guid id)
        {
            if (!Authorized(Role.Admin))
            {
                return(Unauthorized());
            }

            Sympathizer sympathizer = _context.Sympathizers.FirstOrDefault(x => x.Id == id);

            _context.Sympathizers.Remove(sympathizer);
            //Save
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public SympathizerViewModel(Sympathizer sympathizers)
 {
     Sympathizer = sympathizers;
 }
Exemple #4
0
        public PartialViewResult _PartialEditSympathizer(Guid id)
        {
            Sympathizer sympathizer = _context.Sympathizers.FirstOrDefault(x => x.Id == id);

            return(PartialView(new SympathizerViewModel(GetActiveAdherentStolon(), sympathizer)));
        }
Exemple #5
0
 public SympathizerViewModel(AdherentStolon activeAdherentStolon, Sympathizer sympathizer, Stolon stolon = null)
 {
     Sympathizer          = sympathizer;
     ActiveAdherentStolon = activeAdherentStolon;
     Stolon = stolon == null ? Sympathizer.Stolon : stolon;
 }