コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserProfileId,CourseId,DateEnrolled,Score")] UserCourse userCourse)
        {
            if (id != userCourse.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userCourse);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserCourseExists(userCourse.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(userCourse));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PhoneNumber,Address,EmployeeId,DateCreated,DepartmentId,UserType")] UserProfile userProfile)
        {
            if (id != userProfile.Id)
            {
                return(NotFound());
            }

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