目录
[1、 AdminController](#1、 AdminController)
[1.1、 NotEnrolledStudent](#1.1、 NotEnrolledStudent)
[1.2、 // Students Controller End](#1.2、 // Students Controller End)
[1.3、 CourseDetail](#1.3、 CourseDetail)
- AdminController
using ITM_College.Data;
using ITM_College.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ITM_College.Controllers
{
public class AdminController : Controller
{
private readonly ITM_CollegeContext db;
public AdminController(ITM_CollegeContext db)
{
this.db = db;
}
-
- NotEnrolledStudent
public IActionResult NotEnrolledStudent(int id)
{
var student = db.Students.FirstOrDefault(s => s.StudentId == id);
return View(student);
}
public IActionResult StudentRequest()
{
var newStd = db.StudentCourseRegistrations.Include(s => s.AddmissionForNavigation)
.Include(c => c.Student).Where(col => col.Status == 1).ToList();
return View(newStd);
}
-
- // Students Controller End
// ------ Controller 3 Courses Controller ------
// i- All Students
// ii- Add Students
// iii- Update Student
// iv- Delete Student
public IActionResult Courses(string message,string error)
{
ViewBag.message = message;
ViewBag.error = error;
var course = db.Courses.Include(c => c.Faculty).Include(f => f.Faculty.FacultyDepartmentNavigation).ToList();
return View(course);
}
-
- CourseDetail
public IActionResult CourseDetail(int id)
{
var course = db.Courses.Include(c => c.Faculty)
.Include(f => f.Faculty.FacultyDepartmentNavigation)
.Include(s => s.StudentCourseRegistrations)
.FirstOrDefault(col => col.CourseId == id);
return View(course);
}