AdminController

目录

[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)

  1. 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;

}

    1. 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);

}

    1. // 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);

}

    1. 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);

}

相关推荐
syj_1114 小时前
初识ArkUI
ui·arkts·arkui
芋芋qwq12 小时前
Unity UI射线检测 道具拖拽
ui·unity·游戏引擎
鸿蒙自习室13 小时前
鸿蒙多线程开发——线程间数据通信对象02
ui·harmonyos·鸿蒙
大霞上仙16 小时前
element ui table 每行不同状态
vue.js·ui·elementui
栈老师不回家1 天前
Element UI 组件库详解【Vue】
前端·vue.js·ui
郭梧悠1 天前
HarmonyOS(57) UI性能优化
ui·性能优化·harmonyos
wyh要好好学习1 天前
WPF数据加载时添加进度条
ui·wpf
code_shenbing1 天前
跨平台WPF框架Avalonia教程 三
前端·microsoft·ui·c#·wpf·跨平台·界面设计
vvw&2 天前
如何使用 Docker Compose 安装 WireGuard UI
linux·服务器·ui·docker·容器·wireguard·异地组网
老码沉思录2 天前
Android开发实战班 - 现代 UI 开发之 Material Design及自定义主题
android·ui