public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Address,DroneIdNumber")] Users users)
        {
            if (id != users.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Username,Password")] AdministrativeUsers administrativeUsers)
        {
            if (id != administrativeUsers.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(administrativeUsers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdministrativeUsersExists(administrativeUsers.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(administrativeUsers));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Make,Model")] ConsumerDrones consumerDrones)
        {
            if (id != consumerDrones.ID)
            {
                return(NotFound());
            }

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