示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("checkoutId,checkoutLicensePlate,checkoutTime")] CarCheckOut carCheckOut)
        {
            if (id != carCheckOut.checkoutId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carCheckOut);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarCheckOutExists(carCheckOut.checkoutId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(carCheckOut));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("checkoutId,checkoutLicensePlate,checkoutTime")] CarCheckOut carCheckOut)
        {
            if (ModelState.IsValid)
            {
                _context.Add(carCheckOut);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(carCheckOut));
        }