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));
        }
Exemple #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));
        }