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

}

相关推荐
修炼前端秘籍的小帅11 小时前
Stitch——Google热门的免费AI UI设计工具
前端·人工智能·ui
王码码203511 小时前
Flutter for OpenHarmony:socket_io_client 实时通信的事实标准(Node.js 后端的最佳拍档) 深度解析与鸿蒙适配指南
android·flutter·ui·华为·node.js·harmonyos
2501_9219308318 小时前
Flutter for OpenHarmony:第三方库实战 chewie 视频播放器UI组件详解
flutter·ui
梵得儿SHI19 小时前
Vue3 生态工具实战宝典:UI 组件库 + 表单验证全解析(Element Plus/Ant Design Vue/VeeValidate)
前端·vue.js·ui·elementplus·vue性能优化·antdesignvue·表单验证方案
Unity游戏资源学习屋19 小时前
【Unity UI资源包】GUI Pro - Casual Game 专为休闲手游打造的专业级UI资源包
ui·unity
麻瓜呀2 天前
vue2 Element-ui框架相关常见问题-表单组件重置显示异常
运维·服务器·ui
少云清2 天前
【UI自动化测试】4_PO模式 _PO模式封装
ui·po模式
菜鸟小芯2 天前
【GLM-5 陪练式创意 UI 实战】第二篇:创意魔法盒 —— 从 “开心” 到 “科技感”,AI 驱动的 UI 风格迭代
科技·ui