コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Subject,Topic,SchoolType,Experience,StudyDate,AddressLine1,AddressLine2,City,State,Country,ZipCode")] Request request)
        {
            if (id != request.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(request);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RequestExists(request.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(request));
        }
コード例 #2
0
ファイル: UsersController.cs プロジェクト: kittymei/GroupUp
        public async Task <IActionResult> Edit(int id, [Bind("Id,Username,Password,FirstName,LastName,Gender,Dob,Email,StreetAddress,City,Country,ZipCode,Phone")] 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));
        }