微信网站制作免费,在线包装设计软件,通辽做网站0475seo,北京网站制作公司招聘信息大作业名称:学生考试成绩管理系统-简易版
总共分为4个阶段:
第一阶段: 完成原型版V1.0核心业务功能,包括:
A.基础信息维护功能:
1.班级信息维护功能
2.学生信息维护功能
B.分值信息维护功能
依赖关系说明:分值信息依赖于学生信息,学生信息依赖于班级信息
第一阶段V1.0原…大作业名称:学生考试成绩管理系统-简易版
总共分为4个阶段:
第一阶段: 完成原型版V1.0核心业务功能,包括:
A.基础信息维护功能:
1.班级信息维护功能
2.学生信息维护功能
B.分值信息维护功能
依赖关系说明:分值信息依赖于学生信息,学生信息依赖于班级信息
第一阶段V1.0原型版 演示地址 :http://demo.exesoft.cn:9191
第一阶段V1.0源码获得方法:
扫下方二维码,关注gCodeTop公众号, 然后切换至输入状态输入: StuManSys-v1
交互界面会自动回应下载地址.
第二阶段: 完成权限的基本功能点击查看代码过程,包括:
admin用户:拥有最高权限,登陆后,拥有添加,修改,删除等权限.可以查看所有信息.
teacher用户:登陆后,拥有修改权限.可以查看所有信息.
其它用户或所有用户:能搜索查看某编号选手的分值信息.
第二阶段V2.0源码获得方法:
扫下方二维码,关注gCodeTop公众号, 然后切换至输入状态输入: StuManSys-v2
交互界面会自动回应下载地址.
第三阶段: 完成下载及数据导出功能
第四阶段: 完成两个特殊的计算工具
说明:采用Ajax技术,局部刷新.
第五阶段: 美化Web UI,主要内容包括:
分值不及格的成绩,自动用红色标注,表格采用bootstrap等知名库,菜单项有轻微的动画等.
---------------------------------------------------------------------------------------------------
第一阶段核心代码参考:
第一步:创建项目
C#,Asp.net Mvc4,基本
项目名称:StuManSys,全称:Student Management System
第二步:创建Home控制器
只包含一个最简单的Index Action.
第三步:创建Model
在Models目录下,创建下面的类文件:
班级信息类文件 ClassInfo.cs,代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;namespace StuManSys.Models
{public class ClassInfo{[Key]public string ClassID { set; get; }public string ClassName { set; get; }public string FormteacherName{ set; get; }}
}
ClassID:班级编号,主键,字符类型.
ClassName:班级名称,整数类型.
FormteacherName:班主任名称,字符类型.
----------------------------------------------
学生类文件 Student.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;namespace StuManSys.Models
{public class Student{[Key]public int ID { set; get; }public string StuID { set; get; }public string StuName { set; get; }public int Gender { set; get; }public bool LiveAtSchool { set; get; }public string NativePlace { set; get; } public string ClassID { set; get; }public string Remark { set; get; }public virtual ClassInfo ClassInfo{set;get;}}
}
ID:主键,整数,自动递增.
StuID:学生编号,字符类型.
StuName:学生名称,字符类型.
Gender:性别,整数类型,0代表不详,1代表男,2代表女.界面上采用3个RadioButton实现.
LiveAtSchool:是否住校,布尔类型.界面上采用1个CheckBox实现。
NativePlace:籍贯,字符类型.界面上采用DropdownList实现.
ClassID:班级编号,字符类型,外键.界面上采用DropdownList实现.
Remark:备注,字符类型.界面上采用TextArea实现.
ClassInfo:班级信息的导航属性.
--------------------------------------
分数类文件 Mark.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;namespace StuManSys.Models
{public class Mark{[Key][ForeignKey(Student)][Column(StudentID)][DatabaseGenerated(DatabaseGeneratedOption.None)]public int StudentID { set; get; }public virtual Student Student { set; get; }public decimal SqlServer { set; get; }[NotMapped]public long SqlServerRank { set; get; }public decimal Math { set; get; }[NotMapped]public long MathRank { set; get; }public decimal Gym { set; get; }[NotMapped]public long GymRank { set; get; }[NotMapped]public decimal Average { set; get; }[NotMapped]public long Rank { set; get; }}
}
StudentID:整数,主键,同时兼外键,取消默认的自动递增.
SqlServer,Math,Gym:三门课的名称,小数类型.
Student:学生信息导航属性.
SqlServerRank,MathRank,GymRank:三门课的排名,长整数类型.
Average:平均值,小数类型.
Rank:平均值名次,长整数类型.
NotMapped 相关属性不映射产生相关数据库中的表格字段。
--------------------------------------------------
排名类文件 VRank.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;namespace StuManSys.Models
{public class VRank{public int StudentID { set; get; }public long SqlServerRank { set; get; }public long MathRank { set; get; }public long GymRank { set; get; }public decimal Average { set; get; }public long Rank { set; get; }}
}
StudentID:学生编号,整数
SqlServerRank,MathRank,GymRank:长整数,数据库SqlServer,数学,体育三门课的排名.
Average:平均分,小数类型.
Rank:平均分排名,长整数.
VRank类用于:用相应的对象从数据库中视图VRank中,为Mark表传递相关排行榜数据.
-----------------------------------------------------
第四步创建控制器及相关视图
1.创建ClassInfoController控制器等,
选项如下: 后面的控制器产生时,上述相关选项中的Template及Data context class都一样。
如法炮制,再创建StudentController及MarkController控制器及相关视图.
在创建完控制器后,会形成了一个上下文文件,代码如下:
using System.Data.Entity;namespace StuManSys.Models
{public class StuManSysContext : DbContext{// You can add custom code to this file. Changes will not be overwritten.// // If you want Entity Framework to drop and regenerate your database// automatically whenever you change your model schema, add the following// code to the Application_Start method in your Global.asax file.// Note: this will destroy and re-create your database with every model change.// // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChangesStuManSys.Models.StuManSysContext());public StuManSysContext() : base(nameStuManSysContext){}public DbSetClassInfo ClassInfoes { get; set; }public DbSetMark Marks { get; set; }public DbSetStudent Students { get; set; }}
}然后,在Global.ascx文件中的Application_Start()事件中添加: System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChangesStuManSys.Models.StuManSysContext());
第五步:创建排行榜视图:
代码参考:
USE [StuManSysContext-20191027115753]
GO
CREATE view VRank
as
select StudentID,
Dense_Rank() over(order by SqlServer desc) SqlServerRank,
Dense_Rank() over(order by Math desc) MathRank,
Dense_Rank() over(order by Gym desc) GymRank,
(SqlServerMathGym)/3 Average,DENSE_RANK() over(order by (SqlServerMathGym)/3 desc) Rank
from Marks
GO
当这个视图创建成功后,把代码更换成: System.Data.Entity.Database.SetInitializerStuManSys.Models.StuManSysContext(null);
第六步:再修改相关控制器局部代码
最终控制器关键代码如下:
1.ClassInfoController.cs:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StuManSys.Models;namespace StuManSys.Controllers
{public class ClassInfoController : Controller{private StuManSysContext db new StuManSysContext();//// GET: /ClassInfo/public ActionResult Index(){return View(db.ClassInfoes.ToList());}//// GET: /ClassInfo/Details/5public ActionResult Details(string id null){ClassInfo classinfo db.ClassInfoes.Find(id);if (classinfo null){return HttpNotFound();}return View(classinfo);}//// GET: /ClassInfo/Createpublic ActionResult Create(){return View();}//// POST: /ClassInfo/Create[HttpPost]public ActionResult Create(ClassInfo classinfo){if (ModelState.IsValid){db.ClassInfoes.Add(classinfo);db.SaveChanges();return RedirectToAction(Index);}return View(classinfo);}//// GET: /ClassInfo/Edit/5public ActionResult Edit(string id null){ClassInfo classinfo db.ClassInfoes.Find(id);if (classinfo null){return HttpNotFound();}return View(classinfo);}//// POST: /ClassInfo/Edit/5[HttpPost]public ActionResult Edit(ClassInfo classinfo){if (ModelState.IsValid){db.Entry(classinfo).State EntityState.Modified;db.SaveChanges();return RedirectToAction(Index);}return View(classinfo);}//// GET: /ClassInfo/Delete/5public ActionResult Delete(string id null){ClassInfo classinfo db.ClassInfoes.Find(id);if (classinfo null){return HttpNotFound();}return View(classinfo);}//// POST: /ClassInfo/Delete/5[HttpPost, ActionName(Delete)]public ActionResult DeleteConfirmed(string id){ClassInfo classinfo db.ClassInfoes.Find(id);db.ClassInfoes.Remove(classinfo);db.SaveChanges();return RedirectToAction(Index);}protected override void Dispose(bool disposing){db.Dispose();base.Dispose(disposing);}}
}
2.StudentController控制器,代码如下:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StuManSys.Models;namespace StuManSys.Controllers
{public class StudentController : Controller{private StuManSysContext db new StuManSysContext(); // GET: /Student/public ActionResult Index(){ViewBag.ClassID new SelectList(db.ClassInfoes, ClassID, ClassName);return View(db.Students.ToList());}//// GET: /Student/Details/5public ActionResult Details(int id 0){Student student db.Students.Find(id);if (student null){return HttpNotFound();}return View(student);}//// GET: /Student/Createpublic ActionResult Create(){ViewBag.ClassID new SelectList(db.ClassInfoes, ClassID, ClassName);return View();}//// POST: /Student/Create[HttpPost]public ActionResult Create(Student student){if (ModelState.IsValid){Mark m new Mark();m.StudentID student.ID;m.SqlServer 0;m.Math 0;m.Gym 0;db.Marks.Add(m);db.Students.Add(student); db.SaveChanges();return RedirectToAction(Index);}return View(student);}//// GET: /Student/Edit/5public ActionResult Edit(int id 0){Student student db.Students.Find(id);if (student null){return HttpNotFound();}var classinfo db.ClassInfoes; var selectList new SelectList(classinfo, ClassID, ClassName,student.ClassID);ViewBag.ClassID selectList; return View(student);}//// POST: /Student/Edit/5[HttpPost]public ActionResult Edit(Student student){if (ModelState.IsValid){db.Entry(student).State EntityState.Modified;db.SaveChanges();return RedirectToAction(Index);}ViewBag.ClassID new SelectList(db.ClassInfoes, ClassID, ClassName);return View(student);}//// GET: /Student/Delete/5public ActionResult Delete(int id 0){Student student db.Students.Find(id);if (student null){return HttpNotFound();}return View(student);}//// POST: /Student/Delete/5[HttpPost, ActionName(Delete)]public ActionResult DeleteConfirmed(int id){Mark mark db.Marks.Find(id);Student student db.Students.Find(id);db.Marks.Remove(mark);db.Students.Remove(student);db.SaveChanges();return RedirectToAction(Index);}protected override void Dispose(bool disposing){db.Dispose();base.Dispose(disposing);}}
}
3.MarkController控制器,代码如下:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StuManSys.Models;namespace StuManSys.Controllers
{public class MarkController : Controller{private StuManSysContext db new StuManSysContext();//// GET: /Mark/public ActionResult Index(){var ranks db.Database.SqlQueryVRank(SELECT * FROM dbo.VRank);var marks db.Marks.Include(m m.Student);foreach (var m in marks){m.SqlServerRank ranks.Where(i i.StudentID m.StudentID).Select(j j.SqlServerRank).Single();m.MathRank ranks.Where(i i.StudentID m.StudentID).Select(j j.MathRank).Single();m.GymRank ranks.Where(i i.StudentID m.StudentID).Select(j j.GymRank).Single();m.Average ranks.Where(i i.StudentID m.StudentID).Select(j j.Average).Single();m.Rank ranks.Where(i i.StudentID m.StudentID).Select(j j.Rank).Single();}return View(marks.ToList());}//// GET: /Mark/Details/5public ActionResult Details(int id 0){var ranks db.Database.SqlQueryVRank(SELECT * FROM dbo.VRank);Mark m db.Marks.Find(id); if (m null){return HttpNotFound();}m.SqlServerRank ranks.Where(i i.StudentID m.StudentID).Select(j j.SqlServerRank).Single();m.MathRank ranks.Where(i i.StudentID m.StudentID).Select(j j.MathRank).Single();m.GymRank ranks.Where(i i.StudentID m.StudentID).Select(j j.GymRank).Single();m.Average ranks.Where(i i.StudentID m.StudentID).Select(j j.Average).Single();m.Rank ranks.Where(i i.StudentID m.StudentID).Select(j j.Rank).Single();return View(m);}//// GET: /Mark/Createpublic ActionResult Create(){ViewBag.StudentID new SelectList(db.Students, ID, StuID);return View();}//// POST: /Mark/Create[HttpPost]public ActionResult Create(Mark mark){if (ModelState.IsValid){db.Marks.Add(mark);db.SaveChanges();return RedirectToAction(Index);}ViewBag.StudentID new SelectList(db.Students, ID, StuID, mark.StudentID);return View(mark);}//// GET: /Mark/Edit/5public ActionResult Edit(int id 0){Mark mark db.Marks.Find(id);if (mark null){return HttpNotFound();}ViewBag.StudentID new SelectList(db.Students, ID, StuID, mark.StudentID);return View(mark);}//// POST: /Mark/Edit/5[HttpPost]public ActionResult Edit(Mark mark){if (ModelState.IsValid){db.Entry(mark).State EntityState.Modified;db.SaveChanges();return RedirectToAction(Index);}ViewBag.StudentID new SelectList(db.Students, ID, StuID, mark.StudentID);return View(mark);}//// GET: /Mark/Delete/5public ActionResult Delete(int id 0){Mark mark db.Marks.Find(id);if (mark null){return HttpNotFound();}return View(mark);}//// POST: /Mark/Delete/5[HttpPost, ActionName(Delete)]public ActionResult DeleteConfirmed(int id){Mark mark db.Marks.Find(id);db.Marks.Remove(mark);db.SaveChanges();return RedirectToAction(Index);}protected override void Dispose(bool disposing){db.Dispose();base.Dispose(disposing);}}
}
第七步:修改相关View局部代码
Home/Index.csthml:
{ViewBag.Title Index;
}h2学生考试成绩管理系统(原型V1.0)/h2
hr /h3学生基础信息管理/h3
pHtml.ActionLink(班级信息,Index,ClassInfo)/p
pHtml.ActionLink(学生信息,Index,Student)/p
h3学生考分信息管理/h3
pHtml.ActionLink(考分信息,Index,Mark)/p
Student/Index.csthml:
model IEnumerableStuManSys.Models.Student{ViewBag.Title 学生信息;
}h2学生信息/h2
pHtml.ActionLink(返回首页, Index,Home)
/p
pHtml.ActionLink(Create New, Create)
/p
tabletrthHtml.DisplayNameFor(model model.StuID)/ththHtml.DisplayNameFor(model model.StuName)/ththHtml.DisplayNameFor(model model.Gender)/ththHtml.DisplayNameFor(model model.LiveAtSchool)/ththHtml.DisplayNameFor(model model.NativePlace)/ththHtml.DisplayNameFor(model model.ClassInfo.ClassName)/ththHtml.DisplayNameFor(model model.Remark)/thth/th/trforeach (var item in Model) {trtdHtml.DisplayFor(modelItem item.StuID)/tdtdHtml.DisplayFor(modelItem item.StuName)/tdtdif(item.Gender1){:男}else if (item.Gender 2){:女}else{:不详}/tdtdHtml.DisplayFor(modelItem item.LiveAtSchool)/tdtdHtml.DisplayFor(modelItem item.NativePlace)/tdtdHtml.DisplayFor(modelItem item.ClassInfo.ClassName)/tdtdHtml.DisplayFor(modelItem item.Remark)/tdtdHtml.ActionLink(Edit, Edit, new { iditem.ID }) |Html.ActionLink(Details, Details, new { iditem.ID }) |Html.ActionLink(Delete, Delete, new { iditem.ID })/td/tr
}
/table
Student/Create.cshtml:
model StuManSys.Models.Student
{ViewBag.Title Create;ListSelectListItem NativePlaceList new ListSelectListItem {new SelectListItem { Text , Value ,Selected true},new SelectListItem { Text 西安, Value 西安 },new SelectListItem { Text 北京, Value 北京 },new SelectListItem { Text 南京, Value 南京 } };
}h2Create/h2
using (Html.BeginForm()) {Html.ValidationSummary(true)fieldsetlegendStudent/legenddiv classeditor-labelHtml.LabelFor(model model.StuID)/divdiv classeditor-fieldHtml.EditorFor(model model.StuID)Html.ValidationMessageFor(model model.StuID)/divdiv classeditor-labelHtml.LabelFor(model model.StuName)/divdiv classeditor-fieldHtml.EditorFor(model model.StuName)Html.ValidationMessageFor(model model.StuName)/divdiv classeditor-labelHtml.LabelFor(model model.Gender)/divdiv classeditor-fieldHtml.RadioButton(Gender, 0)text不详/textHtml.RadioButton(Gender, 1)text男/textHtml.RadioButton(Gender, 2)text女/textHtml.ValidationMessageFor(model model.Gender)/divdiv classeditor-labelHtml.LabelFor(model model.LiveAtSchool)/divdiv classeditor-fieldHtml.EditorFor(model model.LiveAtSchool)Html.ValidationMessageFor(model model.LiveAtSchool)/divdiv classeditor-labelHtml.LabelFor(model model.NativePlace)/divdiv classeditor-fieldHtml.DropDownList(NativePlace, NativePlaceList)Html.ValidationMessageFor(model model.NativePlace)/divdiv classeditor-labelHtml.LabelFor(model model.ClassID)/divdiv classeditor-fieldHtml.DropDownList(ClassID, String.Empty)Html.ValidationMessageFor(model model.ClassID)/divdiv classeditor-labelHtml.LabelFor(model model.Remark)/divdiv classeditor-fieldHtml.TextAreaFor(model model.Remark)Html.ValidationMessageFor(model model.Remark)/divpinput typesubmit valueCreate //p/fieldset
}divHtml.ActionLink(Back to List, Index)
/divsection Scripts {Scripts.Render(~/bundles/jqueryval)
}Student/Edit.cshtml:
model StuManSys.Models.Student
{ViewBag.Title Edit;ListSelectListItem NativePlace new ListSelectListItem { new SelectListItem { Text , Value ,Selected (Model.NativePlace)}, new SelectListItem { Text 西安, Value 西安,Selected (Model.NativePlace西安)},new SelectListItem { Text 北京, Value 北京,Selected (Model.NativePlace北京) },new SelectListItem { Text 南京, Value 南京,Selected (Model.NativePlace南京) } };}h2Edit/h2
using (Html.BeginForm())
{Html.ValidationSummary(true)fieldsetlegendStudent/legendHtml.HiddenFor(model model.ID)div classeditor-labelHtml.LabelFor(model model.StuID)/divdiv classeditor-fieldHtml.EditorFor(model model.StuID)Html.ValidationMessageFor(model model.StuID)/divdiv classeditor-labelHtml.LabelFor(model model.StuName)/divdiv classeditor-fieldHtml.EditorFor(model model.StuName)Html.ValidationMessageFor(model model.StuName)/divdiv classeditor-labelHtml.LabelFor(model model.Gender)/divdiv classeditor-field Html.RadioButton(Gender, 0)text不详/textHtml.RadioButton(Gender, 1)text男/textHtml.RadioButton(Gender, 2)text女/textHtml.ValidationMessageFor(model model.Gender) /divdiv classeditor-labelHtml.LabelFor(model model.LiveAtSchool)/divdiv classeditor-fieldHtml.EditorFor(model model.LiveAtSchool)Html.ValidationMessageFor(model model.LiveAtSchool)/divdiv classeditor-labelHtml.LabelFor(model model.NativePlace)/divdiv classeditor-fieldHtml.DropDownList(NativePlace,NativePlace)Html.ValidationMessageFor(model model.NativePlace)/divdiv classeditor-labelHtml.LabelFor(model model.ClassID)/divdiv classeditor-fieldHtml.DropDownList(ClassID)Html.ValidationMessageFor(model model.ClassID)/divdiv classeditor-labelHtml.LabelFor(model model.Remark)/divdiv classeditor-fieldHtml.EditorFor(model model.Remark)Html.ValidationMessageFor(model model.Remark)/divpinput typesubmit valueSave //p/fieldset
}divHtml.ActionLink(Back to List, Index)
/divsection Scripts {Scripts.Render(~/bundles/jqueryval)
}Student/Details.cshtml:
model StuManSys.Models.Student{ViewBag.Title Details;
}h2Details/h2
fieldsetlegendStudent/legenddiv classdisplay-labelHtml.DisplayNameFor(model model.StuID)/divdiv classdisplay-fieldHtml.DisplayFor(model model.StuID)/divdiv classdisplay-labelHtml.DisplayNameFor(model model.StuName)/divdiv classdisplay-fieldHtml.DisplayFor(model model.StuName)/divdiv classdisplay-labelHtml.DisplayNameFor(model model.Gender)/divdiv classdisplay-fieldif (Model.Gender 1){:男}else if (Model.Gender 2){:女}else{:不详} /divdiv classdisplay-labelHtml.DisplayNameFor(model model.LiveAtSchool)/divdiv classdisplay-fieldHtml.DisplayFor(model model.LiveAtSchool)/divdiv classdisplay-labelHtml.DisplayNameFor(model model.NativePlace)/divdiv classdisplay-fieldHtml.DisplayFor(model model.NativePlace)/divdiv classdisplay-labelHtml.DisplayNameFor(model model.ClassInfo.ClassName)/divdiv classdisplay-fieldHtml.DisplayFor(model model.ClassInfo.ClassName)/divdiv classdisplay-labelHtml.DisplayNameFor(model model.Remark)/divdiv classdisplay-fieldHtml.DisplayFor(model model.Remark)/div
/fieldset
pHtml.ActionLink(Edit, Edit, new { idModel.ID }) |Html.ActionLink(Back to List, Index)
/pStudent/Delete.cshtml:
model StuManSys.Models.Student{ViewBag.Title Delete;
}h2Delete/h2h3Are you sure you want to delete this?/h3
fieldsetlegendStudent/legenddiv classdisplay-labelHtml.DisplayNameFor(model model.StuID)/divdiv classdisplay-fieldHtml.DisplayFor(model model.StuID)/divdiv classdisplay-labelHtml.DisplayNameFor(model model.StuName)/divdiv classdisplay-fieldHtml.DisplayFor(model model.StuName)/div
/fieldset
using (Html.BeginForm()) {pinput typesubmit valueDelete / |Html.ActionLink(Back to List, Index)/p
}Mark/Index.cshtml:
model IEnumerableStuManSys.Models.Mark{ViewBag.Title 考分信息;
}h2考分信息/h2
pHtml.ActionLink(返回首页, Index,Home)
/p
tabletrthHtml.DisplayNameFor(model model.Student.StuID)/ththHtml.DisplayNameFor(model model.Student.StuName)/ththHtml.DisplayNameFor(model model.Student.ClassInfo.ClassName)/ththHtml.DisplayNameFor(model model.SqlServer)/ththHtml.DisplayNameFor(model model.SqlServerRank)/ththHtml.DisplayNameFor(model model.Math)/ththHtml.DisplayNameFor(model model.MathRank)/ththHtml.DisplayNameFor(model model.Gym)/ththHtml.DisplayNameFor(model model.GymRank)/ththHtml.DisplayNameFor(model model.Average)/ththHtml.DisplayNameFor(model model.Rank)/thth/th/trforeach (var item in Model) {trtdHtml.DisplayFor(modelItem item.Student.StuID)/tdtdHtml.DisplayFor(modelItem item.Student.StuName)/tdtdHtml.DisplayFor(modelItem item.Student.ClassInfo.ClassName)/tdtdHtml.DisplayFor(modelItem item.SqlServer)/tdtdHtml.DisplayFor(modelItem item.SqlServerRank)/tdtdHtml.DisplayFor(modelItem item.Math)/tdtdHtml.DisplayFor(modelItem item.MathRank)/tdtdHtml.DisplayFor(modelItem item.Gym)/tdtdHtml.DisplayFor(modelItem item.GymRank)/tdtdHtml.DisplayFor(modelItem item.Average)/tdtdHtml.DisplayFor(modelItem item.Rank)/tdtdHtml.ActionLink(Edit, Edit, new { iditem.StudentID }) |Html.ActionLink(Details, Details, new { iditem.StudentID }) /td/tr
}
/table
Mark/Edit.cshtml:
model StuManSys.Models.Mark{ViewBag.Title Edit;
}h2Edit/h2
using (Html.BeginForm()) {Html.ValidationSummary(true)fieldsetlegendMark/legendHtml.HiddenFor(model model.StudentID)div classeditor-labelHtml.LabelFor(model model.Student.StuID)/divdiv classeditor-fieldHtml.DisplayFor(model model.Student.StuID) /divdiv classeditor-labelHtml.LabelFor(model model.Student.StuName)/divdiv classeditor-fieldHtml.DisplayFor(model model.Student.StuName) /divdiv classeditor-labelHtml.LabelFor(model model.Student.ClassInfo.ClassName)/divdiv classeditor-fieldHtml.DisplayFor(model model.Student.ClassInfo.ClassName)/div div classeditor-labelHtml.LabelFor(model model.SqlServer)/divdiv classeditor-fieldHtml.EditorFor(model model.SqlServer)Html.ValidationMessageFor(model model.SqlServer)/div div classeditor-labelHtml.LabelFor(model model.Math)/divdiv classeditor-fieldHtml.EditorFor(model model.Math)Html.ValidationMessageFor(model model.Math)/divdiv classeditor-labelHtml.LabelFor(model model.Gym)/divdiv classeditor-fieldHtml.EditorFor(model model.Gym)Html.ValidationMessageFor(model model.Gym)/div pinput typesubmit valueSave //p/fieldset
}divHtml.ActionLink(Back to List, Index)
/divsection Scripts {Scripts.Render(~/bundles/jqueryval)
}附:相关表格及视图结构: