public async Task <IActionResult> Edit(int id, [Bind("Dodid,Uic,CommandName,Ao,Email,Phone,Rank,FirstName,MiddleName,LastName")] User user)
        {
            if (id != user.Dodid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Dodid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Uic"] = new SelectList(_context.Requests, "Uic", "Uic", user.Uic);
            return(View(user));
        }
Пример #2
0
        public async Task <IActionResult> Edit(string id, [Bind("Uic,Serial,SpecialType,RegularType,DateIn")] Request request)
        {
            if (id != request.Uic)
            {
                return(NotFound());
            }

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