public ActionResult EditLecturers([Bind(Include = "Id,FullName,Departament")] Teachers lecturer) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Entry(lecturer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Lecturers")); } } return(View(lecturer)); }
public ActionResult EditSubjects([Bind(Include = "Id,Name,Departament")] Subjects subject) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Entry(subject).State = EntityState.Modified; db.SaveChanges(); //RedirectToAction("Subjects"); } } return(RedirectToAction("Subjects"));//View(subject); }
public ActionResult AddSubjects([Bind(Include = "Id,Name,Departament")] Subjects subject) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Subjects.Add(subject); db.SaveChanges(); return(RedirectToAction("Subjects")); } } return(View(subject)); }
public ActionResult DeleteStudent(int id) { Students student; using (DiaryConnection db = new DiaryConnection()) student = db.Students.Find(id); if (student == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(student)); }
public ActionResult ConfirmStudentRegistration(int?id) { if (id == null) { return(HttpNotFound()); } ApplicationsForRegistration application; DiaryConnection db = new DiaryConnection(); application = db.ApplicationsForRegistration.Find(id); ViewBag.FoundStudents = db.Students.Where(p => (p.FullName.Contains(application.FirstName) && p.FullName.Contains(application.SecondName)) || p.Number == application.CardNumber).ToList(); return(View(application)); }
public ActionResult EditSemester([Bind(Include = "Id,BeginningDate,EndDate,Number,Year")] Semester semester) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Entry(semester).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Semesters")); } } return(View(semester)); }
public ActionResult AddLecturers([Bind(Include = "Id,FullName,Departament")] Teachers lecturer) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Teachers.Add(lecturer); db.SaveChanges(); return(RedirectToAction("AddLecturers")); } } return(View(lecturer)); }
public ActionResult DeleteGroupConfirmed(int id) { using (DiaryConnection db = new DiaryConnection()) { Groups group = db.Groups.Find(id); if (group == null) { return(HttpNotFound()); } db.Groups.Remove(group); db.SaveChanges(); } return(RedirectToAction("Groups")); }
public ActionResult AddGroups([Bind(Include = "Id,Number,YearOfAdmission,Faculty,Degree,FormOfStudy,MonitorId")] Groups groups) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Groups.Add(groups); db.SaveChanges(); return(RedirectToAction("Groups")); } } ViewBag.ErrorMessage = "Неверный ввод данных"; return(View(groups)); }
public ActionResult DeleteApplicationsForRegistrationConfirmed(int id) { using (DiaryConnection db = new DiaryConnection()) { ApplicationsForRegistration application = db.ApplicationsForRegistration.Find(id); if (application == null) { return(HttpNotFound()); } db.ApplicationsForRegistration.Remove(application); db.SaveChanges(); } return(RedirectToAction("ApplicationsForRegistration")); }
public ActionResult DeleteLecturerGroupSubjectConfirmed(int id) { using (DiaryConnection db = new DiaryConnection()) { TeachersGroupsSubjects lgs = db.TeachersGroupsSubjects.Find(id); if (lgs == null) { return(HttpNotFound()); } db.TeachersGroupsSubjects.Remove(lgs); db.SaveChanges(); } return(RedirectToAction("LecturerGroupSubject")); }
//регистрация public ActionResult ApplicationsForRegistration() { using (DiaryConnection db = new DiaryConnection()) { var groups = db.Groups.ToList(); foreach (var b in groups) { b.Number = b.GetGroupNumber(Semester.Today()); } Groups nullGroup = new Groups(); ViewBag.Groups = new SelectList(groups, "Id", "Number", new Groups()); } return(View()); }
public ActionResult DeleteLecturerConfirmed(int id) { using (DiaryConnection db = new DiaryConnection()) { Teachers lecturer = db.Teachers.Find(id); if (lecturer == null) { return(HttpNotFound()); } db.Teachers.Remove(lecturer); db.SaveChanges(); } return(RedirectToAction("Lecturers")); }
public ActionResult DeleteSemesterConfirmed(int id) { using (DiaryConnection db = new DiaryConnection()) { Semester semester = db.Semester.Find(id); if (semester == null) { return(HttpNotFound()); } db.Semester.Remove(semester); db.SaveChanges(); } return(RedirectToAction("Semesters")); }
public ActionResult DeleteSubjectsConfirmed(int id) { using (DiaryConnection db = new DiaryConnection()) { Subjects subject = db.Subjects.Find(id); if (subject == null) { return(HttpNotFound()); } db.Subjects.Remove(subject); db.SaveChanges(); } return(RedirectToAction("Subjects")); }
public ActionResult AddStudents() { List <Groups> groups = new List <Models.Groups>(); using (DiaryConnection db = new DiaryConnection()) { groups = db.Groups.ToList(); foreach (var b in groups) { b.Number = b.GetGroupNumber(Semester.Today()); ViewBag.Groups = new SelectList(groups, "Id", "Number"); } } return(View()); }
public ActionResult ApplicationsForRegistrationSearch(string firstName, string secondName, string middleName, string number, int?group) { List <ApplicationsForRegistration> appl = null; DiaryConnection db = new DiaryConnection(); if (group == null) { appl = db.ApplicationsForRegistration.Where(p => p.FirstName.Contains(firstName) && p.SecondName.Contains(secondName) && p.CardNumber.Contains(number) && p.MiddleName.Contains(middleName) && p.CardNumber.Contains(number)).ToList(); } else { appl = db.ApplicationsForRegistration.Where(p => p.FirstName.Contains(firstName) && p.SecondName.Contains(secondName) && p.CardNumber.Contains(number) && p.MiddleName.Contains(middleName) && p.CardNumber.Contains(number) && p.GroupId == group).ToList(); } return(View(appl)); }
public ActionResult AddLecturerGroupSubject() { using (DiaryConnection db = new DiaryConnection()) { var groups = db.Groups.ToList(); foreach (var b in groups) { b.Number = b.GetGroupNumber(Semester.Today()); } ViewBag.Groups = new SelectList(groups, "Id", "Number"); ViewBag.Lecturers = new SelectList(db.Teachers.ToList(), "Id", "FullName"); ViewBag.Subjects = new SelectList(db.Subjects.ToList(), "Id", "Name"); } return(View()); }
public ActionResult EditSubjects(int?id) { if (id == null) { return(HttpNotFound()); } Subjects subject; using (DiaryConnection db = new DiaryConnection()) subject = db.Subjects.Find(id); if (subject != null) { return(View(subject)); } return(HttpNotFound()); }
public ActionResult EditLecturers(int?id) { if (id == null) { return(HttpNotFound()); } Teachers lecturer; using (DiaryConnection db = new DiaryConnection()) lecturer = db.Teachers.Find(id); if (lecturer != null) { return(View(lecturer)); } return(HttpNotFound()); }
public ActionResult EditSemester(int?id) { if (id == null) { return(HttpNotFound()); } Semester semester; using (DiaryConnection db = new DiaryConnection()) semester = db.Semester.Find(id); if (semester != null) { return(View(semester)); } return(HttpNotFound()); }
public ActionResult StudentsSearchForApplication(string number, string fullName, string groupNumber, int applicationId) { List <Students> foundStudents; using (DiaryConnection db = new DiaryConnection()) { if (number == "" && fullName == "" && groupNumber == "") { foundStudents = db.Students.ToList(); } else if (fullName == "" && groupNumber == "") { foundStudents = db.Students.Where(p => p.Number == number).ToList(); } else if (number == "" && groupNumber == "") { foundStudents = db.Students.Where(p => p.FullName.Contains(fullName)).ToList(); } else if (number == "" && fullName == "") { var students = db.Students.ToList(); foundStudents = students.Where(p => p.Groups1.GetGroupNumber(Semester.Today()) == Convert.ToInt32(groupNumber)).ToList(); } else if (groupNumber == null) { foundStudents = db.Students.Where(p => p.Number == number && p.FullName.Contains(fullName)).ToList(); } else if (number == "") { foundStudents = db.Students.Where(p => p.FullName.Contains(fullName)).ToList(). Where(p => p.Groups1.GetGroupNumber(Semester.Today()) == Convert.ToInt32(groupNumber)).ToList(); } else if (fullName == "") { foundStudents = db.Students.Where(p => p.Number == number).ToList(). Where(p => p.Groups1.GetGroupNumber(Semester.Today()) == Convert.ToInt32(groupNumber)).ToList(); } else { foundStudents = db.Students.Where(p => p.Number == number && p.FullName.Contains(fullName)).ToList(). Where(p => p.Groups1.GetGroupNumber(Semester.Today()) == Convert.ToInt32(groupNumber)).ToList(); } foundStudents.RemoveAll(p => p.UserName != null); } ViewBag.ApplicationId = applicationId; return(PartialView(foundStudents)); }
public ActionResult DeleteLecturer(int?id) { if (id == null) { return(HttpNotFound()); } Teachers lecturer; using (DiaryConnection db = new DiaryConnection()) lecturer = db.Teachers.Find(id); if (lecturer == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(lecturer)); }
public ActionResult DeleteLecturerGroupSubject(int?id) { if (id == null) { return(HttpNotFound()); } TeachersGroupsSubjects lgs; DiaryConnection db = new DiaryConnection(); lgs = db.TeachersGroupsSubjects.Find(id); if (lgs == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(lgs)); }
public ActionResult DeleteSemester(int?id) { if (id == null) { return(HttpNotFound()); } Semester semester; using (DiaryConnection db = new DiaryConnection()) semester = db.Semester.Find(id); if (semester == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(semester)); }
public ActionResult DeleteApplicationsForRegistration(int?id) { if (id == null) { return(HttpNotFound()); } ApplicationsForRegistration application; DiaryConnection db = new DiaryConnection(); application = db.ApplicationsForRegistration.Find(id); if (application == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(application)); }
public ActionResult DeleteGroups(int?id) { if (id == null) { return(HttpNotFound()); } Groups group; using (DiaryConnection db = new DiaryConnection()) group = db.Groups.Find(id); if (group == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(group)); }
public ActionResult DeleteSubjects(int?id) { if (id == null) { return(HttpNotFound()); } Subjects subject; using (DiaryConnection db = new DiaryConnection()) subject = db.Subjects.Find(id); if (subject == null) { return(HttpNotFound()); } ViewBag.Id = id; return(View(subject)); }
public ActionResult EditGroups([Bind(Include = "Id,Number,YearOfAdmission,Faculty,Degree,FormOfStudy,MonitorId")] Groups group) { using (DiaryConnection db = new DiaryConnection()) { if (ModelState.IsValid) { db.Entry(group).State = EntityState.Modified; db.SaveChanges(); } else { var students = db.Students.Where(p => p.GroupId == group.Id); ViewBag.Students = new SelectList(students, "Id", "FullName", group.Students); db.Dispose(); return(View(group)); } } return(RedirectToAction("Groups")); }
public ActionResult ShowStudents(int?id) { Groups group; List <Students> students; if (id == null) { return(HttpNotFound()); } using (DiaryConnection db = new DiaryConnection()) { group = db.Groups.Find(id); if (group == null) { return(HttpNotFound()); } students = group.Students1.ToList(); } return(View(students)); }