Exemplo n.º 1
0
        public List <Enrollment> DeleteEnrollment(Enrollment enrollment)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Enrollments.Attach(enrollment);
                _context.Enrollments.Remove(enrollment);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Enrollments.ToList());
        }
Exemplo n.º 2
0
        public List <Contract> DeleteContract(Contract contract)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Contracts.Attach(contract);
                _context.Contracts.Remove(contract);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Contracts.ToList());
        }
Exemplo n.º 3
0
        public List <Schedule> DeleteSchedule(Schedule schedule)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Schedules.Attach(schedule);
                _context.Schedules.Remove(schedule);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Schedules.ToList());
        }
Exemplo n.º 4
0
        public List <Part> DeletePart(Part part)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Parts.Attach(part);
                _context.Parts.Remove(part);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Parts.ToList());
        }
Exemplo n.º 5
0
        public List <Advisory> DeleteAdvisory(Advisory advisory)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Advisories.Attach(advisory);
                _context.Advisories.Remove(advisory);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Advisories.ToList());
        }
Exemplo n.º 6
0
        public List <Section> DeleteSection(Section section)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Sections.Attach(section);
                _context.Sections.Remove(section);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Sections.ToList());
        }
Exemplo n.º 7
0
        public List <Employee> GetEmployees(string query)
        {
            var stringProperties = typeof(Employee).GetProperties().Where(prop =>
                                                                          prop.PropertyType == typeof(string) ||
                                                                          prop.PropertyType == typeof(int) ||
                                                                          prop.PropertyType == typeof(int?)
                                                                          );

            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Employees.Where(
                       delegate(Employee x)
            {
                return stringProperties.Any(prop => (prop.PropertyType == typeof(int) && prop.GetValue(x)?.ToString() == query) ||
                                            (prop.PropertyType == typeof(int?) && prop.GetValue(x)?.ToString() == query) ||
                                            (prop.PropertyType == typeof(string) && EF.Functions.Like(prop.GetValue(x)?.ToString(), $"%{query}%")));
            }
                       ).ToList());
        }
Exemplo n.º 8
0
        public List <PartUsage> GetPartUsages()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.PartUsages.ToList());
        }
Exemplo n.º 9
0
        public List <Part> GetPartUsagePart(int partUsagePartId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Parts.Where(x => x.PartId == partUsagePartId).ToList());
        }
Exemplo n.º 10
0
        public List <Professor> GetProfessorContractProfessor(int professorContractProfessorId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Professors.Where(x => x.ProfessorId == professorContractProfessorId).ToList());
        }
Exemplo n.º 11
0
        public List <Contract> GetContractContractContract(int professorContractContractId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Contracts.Where(x => x.ContractId == professorContractContractId).ToList());
        }
Exemplo n.º 12
0
 public List <Employee> GetEmployees()
 {
     using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);
     return(_context.Employees.ToList());
 }
Exemplo n.º 13
0
        public List <School> GetSchools()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Schools.ToList());
        }
Exemplo n.º 14
0
        public List <ReservationForm> GetEmployeeReservationForms(int employeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.ReservationForms.Where(x => x.EmployeeId == employeeId).ToList());
        }
Exemplo n.º 15
0
        public List <Reservation> GetReservationFormReservation(int reservationFormReservationId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Reservations.Where(x => x.ReservationId == reservationFormReservationId).ToList());
        }
Exemplo n.º 16
0
        public List <Employee> GetMaintenanceReleasingMechanic(int maintenanceEmployeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Employees.Where(x => x.EmployeeId == maintenanceEmployeeId).ToList());
        }
Exemplo n.º 17
0
        public List <Vehicle> GetMaintenanceVehicle(int maintenanceVehicleId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Vehicles.Where(x => x.VehicleId == maintenanceVehicleId).ToList());
        }
Exemplo n.º 18
0
        public List <Maintenance> GetMaintenances()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Maintenances.ToList());
        }
Exemplo n.º 19
0
        public List <Department> GetSchoolDepartments(int schoolId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Departments.Where(x => x.SchoolId == schoolId).ToList());
        }
Exemplo n.º 20
0
        public List <Professor> GetSchoolDean(int schoolProfessorId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Professors.Where(x => x.ProfessorId == schoolProfessorId).ToList());
        }
Exemplo n.º 21
0
        public List <MaintenanceDetail> GetPartUsageMaintenanceDetail(int partUsageMaintenanceDetailId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.MaintenanceDetails.Where(x => x.MaintenanceDetailId == partUsageMaintenanceDetailId).ToList());
        }
Exemplo n.º 22
0
        public List <Tenure> GetTenures()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Tenures.ToList());
        }
Exemplo n.º 23
0
        public List <ReservationForm> GetReservationForms()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.ReservationForms.ToList());
        }
Exemplo n.º 24
0
        public List <Vehicle> GetReservationVehicle(int reservationVehicleId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Vehicles.Where(x => x.VehicleId == reservationVehicleId).ToList());
        }
Exemplo n.º 25
0
        public List <Employee> GetReservationFormEmployee(int reservationFormEmployeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Employees.Where(x => x.EmployeeId == reservationFormEmployeeId).ToList());
        }
Exemplo n.º 26
0
        public List <ProfessorContract> GetProfessorContracts()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.ProfessorContracts.ToList());
        }
Exemplo n.º 27
0
        public List <Report> GetMaintenanceReport(int maintenanceReportId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Reports.Where(x => x.ReportId == maintenanceReportId).ToList());
        }
Exemplo n.º 28
0
        public List <Department> GetTenureDepartment(int tenureDepartmentId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Departments.Where(x => x.DepartmentId == tenureDepartmentId).ToList());
        }
Exemplo n.º 29
0
        public List <MaintenanceDetail> GetEmployeeMaintenanceDetails(int employeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.MaintenanceDetails.Where(x => x.EmployeeId == employeeId).ToList());
        }
Exemplo n.º 30
0
        public List <Department> GetProfessorshipDepartment(int professorshipDepartmentId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Departments.Where(x => x.DepartmentId == professorshipDepartmentId).ToList());
        }