/// <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")); }
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; }
public PartialViewResult _PartialEditSympathizer(Guid id) { Sympathizer sympathizer = _context.Sympathizers.FirstOrDefault(x => x.Id == id); return(PartialView(new SympathizerViewModel(GetActiveAdherentStolon(), sympathizer))); }
public SympathizerViewModel(AdherentStolon activeAdherentStolon, Sympathizer sympathizer, Stolon stolon = null) { Sympathizer = sympathizer; ActiveAdherentStolon = activeAdherentStolon; Stolon = stolon == null ? Sympathizer.Stolon : stolon; }