コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,GameDate,PaymentDate,Description,ClubId,PaymentBeforeTax,Tax,Payment,CSPStatusId")] CleverServicePayments cleverServicePayments)
        {
            if (id != cleverServicePayments.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cleverServicePayments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CleverServicePaymentsExists(cleverServicePayments.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CSPStatusId"] = new SelectList(_context.Set <CSPStatus>(), "Id", "CSPStatusName", cleverServicePayments.CSPStatusId);
            ViewData["ClubId"]      = new SelectList(_context.Club, "Id", "ClubName", cleverServicePayments.ClubId);
            return(View(cleverServicePayments));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,GameDate,PaymentDate,Description,ClubId,PaymentBeforeTax,Tax,Payment,CSPStatusId")] CleverServicePayments cleverServicePayments)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cleverServicePayments);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CSPStatusId"] = new SelectList(_context.Set <CSPStatus>(), "Id", "CSPStatusName", cleverServicePayments.CSPStatusId);
            ViewData["ClubId"]      = new SelectList(_context.Club, "Id", "ClubName", cleverServicePayments.ClubId);
            return(View(cleverServicePayments));
        }