Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Weight,IsPackageDelivered,IsPackagePaid")] Package package)
        {
            if (id != package.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(package);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PackageExists(package.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(package));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Age,PhoneNumber")] Courier courier)
        {
            if (id != courier.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(courier);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourierExists(courier.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(courier));
        }