public static async Task <BudgetDbContext> AddPaymentTypesAsync(this BudgetDbContext context) { if (!await context.PaymentTypes.AnyAsync()) { context.Add(new PaymentType() { Name = "Cash" }); context.Add(new PaymentType() { Name = "Debit Card" }); context.Add(new PaymentType() { Name = "Credit Card" }); } return(context); }
public static async Task <BudgetDbContext> AddCurrenciesAsync(this BudgetDbContext context) { if (!await context.Currencies.AnyAsync()) { context.Add(new Currency() { Name = "Bulgarian lev", Abbreviation = "BGN" }); context.Add(new Currency() { Name = "European Euro", Abbreviation = "EUR" }); context.Add(new Currency() { Name = "U.S. Dollar", Abbreviation = "USD" }); } return(context); }
public async Task <IActionResult> Create([Bind("Id,Nom,Ville")] Banque banque) { if (ModelState.IsValid) { banque.Id = Guid.NewGuid(); _context.Add(banque); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(banque)); }
public async Task <IActionResult> Create([Bind("IdCompte,Date,Libelle,Debit,Montant")] Ecriture ecriture) { if (ModelState.IsValid) { ecriture.Id = Guid.NewGuid(); _context.Add(ecriture); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ecriture)); }
public async Task <IActionResult> Create([Bind("Id,Numero,Type,IdPersonne,IdBanque")] Compte compte) { if (ModelState.IsValid) { compte.Id = Guid.NewGuid(); _context.Add(compte); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(compte)); }
public async Task <IActionResult> Create([Bind("Id,Nom,Prenom,DateDeNaissance,Mail")] Personne personne) { if (ModelState.IsValid) { personne.Id = Guid.NewGuid(); _context.Add(personne); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(personne)); }