示例#1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,CreateTime")] UserInfoDto userInfoDto)
        {
            if (id != userInfoDto.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userInfoDto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserInfoDtoExists(userInfoDto.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(userInfoDto));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Location_IdLocation,username,passwords")] UserInfo userInfo)
        {
            if (id != userInfo.Id)
            {
                return(NotFound());
            }

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