public async Task <IActionResult> Edit(int id, [Bind("PenggalanganDanaId,Name,Phone,Address,Total,AccountNumber,Bank,Id")] Donasi donasi)
        {
            if (id != donasi.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(donasi);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DonasiExists(donasi.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PenggalanganDanaId"] = new SelectList(_context.PenggalanganDana, "Id", "Description", donasi.PenggalanganDanaId);
            return(View(donasi));
        }
        public async Task <IActionResult> Create([Bind("PenggalanganDanaId,Name,Phone,Address,Total,AccountNumber,Bank,Id")] Donasi donasi)
        {
            if (ModelState.IsValid)
            {
                _context.Add(donasi);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PenggalanganDanaId"] = new SelectList(_context.PenggalanganDana, "Id", "Description", donasi.PenggalanganDanaId);
            return(View(donasi));
        }
Exemple #3
0
        private void TombolDonasi_Click(object sender, EventArgs e)
        {
            Donasi EC = new Donasi();

            //CHECKING WHETHER THE FORM HAS BEEN OPENED OR NOT YET
            if (Application.OpenForms["Donasi"] == null)
            {
                Notification("Kamu membuka form Donasi", ModernNotification.NotifTypeEnum.Default);
                EC.Show();
            }
            else
            {
                Notification("Form sudah terbuka, jangan dibuka lagi", ModernNotification.NotifTypeEnum.Default);
            }
        }