public ActionResult Details(long code, string dates) { try { SchoolId = USession.School_Id; DropDownList("%"); HomeWorkModel TModel = new HomeWorkModel(); tblAssignmentHeader TCtable = Connection.tblAssignmentHeaders.SingleOrDefault(x => x.AssignmentNo == code); TModel.SubjectId = TCtable.SubjectId; TModel.GradeId = TCtable.GradeId; TModel.ClassId = TCtable.ClassId; tblClass TClass = Connection.tblClasses.SingleOrDefault(x => x.ClassId == TCtable.ClassId && x.GradeId == TCtable.GradeId && x.SchoolId == SchoolId); TModel.Class = TClass.ClassName; tblGrade TGrade = Connection.tblGrades.SingleOrDefault(x => x.GradeId == TCtable.GradeId); TModel.Grade = TGrade.GradeName; tblSubject TSubject = Connection.tblSubjects.SingleOrDefault(x => x.SubjectId == TCtable.SubjectId); TModel.Subject = TSubject.SubjectName; TModel.stringDueDate = dates; TModel.AssignmentDescription = TCtable.AssignmentDescription; TModel.BatchNo = TCtable.BatchNo; TModel.BatchDescription = TCtable.BatchDescription; TModel.FilePath = TCtable.FilePath; TModel.AssignmentNo = TCtable.AssignmentNo; return(PartialView("DetailView", TModel)); } catch (Exception ex) { Errorlog.ErrorManager.LogError(ex); return(View()); } }
public ActionResult Edit(long Code, string dates) { try { SchoolId = USession.School_Id; HomeWorkModel TModel = new HomeWorkModel(); tblAssignmentHeader TCtable = Connection.tblAssignmentHeaders.SingleOrDefault(x => x.AssignmentNo == Code); TModel.SubjectId = TCtable.SubjectId; TModel.GradeId = TCtable.GradeId; TModel.ClassId = TCtable.ClassId; tblClass TClass = Connection.tblClasses.SingleOrDefault(x => x.ClassId == TCtable.ClassId && x.GradeId == TCtable.GradeId && x.SchoolId == SchoolId); TModel.Class = TClass.ClassName; tblGrade TGrade = Connection.tblGrades.SingleOrDefault(x => x.GradeId == TCtable.GradeId); TModel.Grade = TGrade.GradeName; tblSubject TSubject = Connection.tblSubjects.SingleOrDefault(x => x.SubjectId == TCtable.SubjectId); TModel.Subject = TSubject.SubjectName; TModel.stringDueDate = dates; TModel.AssignmentDescription = TCtable.AssignmentDescription; TModel.BatchNo = TCtable.BatchNo; TModel.BatchDescription = TCtable.BatchDescription; TModel.FilePath = TCtable.FilePath; TModel.AssignmentNo = TCtable.AssignmentNo; DropDownList(TCtable.GradeId); var Subject = Connection.GDgetGradeActiveSubject(SchoolId, TCtable.GradeId, "Y");; List <GDgetGradeActiveSubject_Result> Subjectlist = Subject.ToList(); ViewBag.SubjectId = new SelectList(Subjectlist, "SubjectId", "SubjectName"); ViewBag.SubjectIdtxt = TCtable.SubjectId; return(PartialView("EditView", TModel)); } catch (Exception ex) { Errorlog.ErrorManager.LogError(ex); return(View()); } }