예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FollowingId,FollowerId,FollowState")] Follow follow)
        {
            if (id != follow.FollowID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(follow);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FollowExists(follow.FollowID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(follow));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("SignupID,RideID,RiderID")] Signup signup)
        {
            if (id != signup.SignupID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(signup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SignupExists(signup.SignupID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RideID"]  = new SelectList(_context.Rides, "ID", "Description", signup.RideID);
            ViewData["RiderID"] = new SelectList(_context.Riders, "ID", "EmailAddress", signup.RiderID);
            return(View(signup));
        }