public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Role role) { if (id != role.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(role); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleExists(role.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(role)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,CourseId,SectionId,Contents,Status")] Lesson lesson) { if (id != lesson.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lesson); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LessonExists(lesson.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Course, "Id", "Title", lesson.CourseId); ViewData["SectionId"] = new SelectList(_context.Section, "Id", "Name", lesson.SectionId); return(View(lesson)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Parent,Slug,Status")] Category category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ShortDescription,Description,CategoryId,UserId,Thumbnail,Status")] Course course) { if (id != course.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Id", course.CategoryId); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", course.UserId); return(View(course)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Thumbnail,Email,Phone,Password,RoleId,Status,Account")] Users users) { if (id != users.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(users); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsersExists(users.Id)) { } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Role, "Id", "Id", users.RoleId); return(View(users)); }