public ActionResult My() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.PerformComment.My(); vm.YearList = Basis.Controllers.YearController.SelectList(Code.EnumHelper.YearType.Section); if (vm.YearId == 0 && vm.YearList.Count > 0) { vm.YearId = vm.YearList.OrderByDescending(d => d.Selected).FirstOrDefault().Value.ConvertToInt(); } vm.PerformCommentInfo = (from p in db.Table <Perform.Entity.tbPerformComment>() where p.tbStudent.tbSysUser.Id == Code.Common.UserId && p.tbYear.Id == vm.YearId select new Dto.PerformComment.Info { Id = p.Id, StudentCode = p.tbStudent.StudentCode, StudentName = p.tbStudent.StudentName, Comment = p.Comment, TeacherName = p.tbSysUser.UserName, InputDate = p.InputDate }).FirstOrDefault(); return(View(vm)); } }
public ActionResult My(Models.PerformComment.My vm) { return(Code.MvcHelper.Post(null, Url.Action("My", new { yearId = vm.YearId }))); }