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()); }
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()); }
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()); }
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()); }
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()); }
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()); }
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()); }
public List <PartUsage> GetPartUsages() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.PartUsages.ToList()); }
public List <Part> GetPartUsagePart(int partUsagePartId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Parts.Where(x => x.PartId == partUsagePartId).ToList()); }
public List <Professor> GetProfessorContractProfessor(int professorContractProfessorId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Professors.Where(x => x.ProfessorId == professorContractProfessorId).ToList()); }
public List <Contract> GetContractContractContract(int professorContractContractId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Contracts.Where(x => x.ContractId == professorContractContractId).ToList()); }
public List <Employee> GetEmployees() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Employees.ToList()); }
public List <School> GetSchools() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Schools.ToList()); }
public List <ReservationForm> GetEmployeeReservationForms(int employeeId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.ReservationForms.Where(x => x.EmployeeId == employeeId).ToList()); }
public List <Reservation> GetReservationFormReservation(int reservationFormReservationId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Reservations.Where(x => x.ReservationId == reservationFormReservationId).ToList()); }
public List <Employee> GetMaintenanceReleasingMechanic(int maintenanceEmployeeId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Employees.Where(x => x.EmployeeId == maintenanceEmployeeId).ToList()); }
public List <Vehicle> GetMaintenanceVehicle(int maintenanceVehicleId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Vehicles.Where(x => x.VehicleId == maintenanceVehicleId).ToList()); }
public List <Maintenance> GetMaintenances() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Maintenances.ToList()); }
public List <Department> GetSchoolDepartments(int schoolId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Departments.Where(x => x.SchoolId == schoolId).ToList()); }
public List <Professor> GetSchoolDean(int schoolProfessorId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Professors.Where(x => x.ProfessorId == schoolProfessorId).ToList()); }
public List <MaintenanceDetail> GetPartUsageMaintenanceDetail(int partUsageMaintenanceDetailId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.MaintenanceDetails.Where(x => x.MaintenanceDetailId == partUsageMaintenanceDetailId).ToList()); }
public List <Tenure> GetTenures() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Tenures.ToList()); }
public List <ReservationForm> GetReservationForms() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.ReservationForms.ToList()); }
public List <Vehicle> GetReservationVehicle(int reservationVehicleId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Vehicles.Where(x => x.VehicleId == reservationVehicleId).ToList()); }
public List <Employee> GetReservationFormEmployee(int reservationFormEmployeeId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Employees.Where(x => x.EmployeeId == reservationFormEmployeeId).ToList()); }
public List <ProfessorContract> GetProfessorContracts() { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.ProfessorContracts.ToList()); }
public List <Report> GetMaintenanceReport(int maintenanceReportId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Reports.Where(x => x.ReportId == maintenanceReportId).ToList()); }
public List <Department> GetTenureDepartment(int tenureDepartmentId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Departments.Where(x => x.DepartmentId == tenureDepartmentId).ToList()); }
public List <MaintenanceDetail> GetEmployeeMaintenanceDetails(int employeeId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.MaintenanceDetails.Where(x => x.EmployeeId == employeeId).ToList()); }
public List <Department> GetProfessorshipDepartment(int professorshipDepartmentId) { using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options); return(_context.Departments.Where(x => x.DepartmentId == professorshipDepartmentId).ToList()); }