// GET: Instructors public ActionResult Index(string _orderBy, string _sortDirection) { string currentSort = ""; if (_sortDirection == null && _orderBy != null) { ViewData["sortDirection"] = "desc"; currentSort = "asc"; } else if (_sortDirection == null && _orderBy == null) { _orderBy = "CohortId"; currentSort = "asc"; ViewData["sortDirection"] = ""; } else if (_sortDirection == "asc") { ViewData["sortDirection"] = "desc"; currentSort = "asc"; } else if (_sortDirection == "desc") { ViewData["sortDirection"] = "asc"; currentSort = "desc"; } var instructors = InstructorRepository.GetInstructors(_orderBy, currentSort); return(View(instructors)); }
public List <Instructor> GetAllInstructor() { InstructorRepository instructorRepository = new InstructorRepository(); var instructor = instructorRepository.GetAll(); return(instructor); }
public void DeleteInstructor(int id) { InstructorRepository instructorRepository = new InstructorRepository(); Instructor obj = instructorRepository.GetByID(id); instructorRepository.Delete(obj); }
// GET: Instructor/Edit/5 public ActionResult Edit(int id) { Instructor getInst = InstructorRepository.GetSingleInstructor(id); IntructorCreateNewModel model = new IntructorCreateNewModel(getInst); return(View(model)); }
public List <Instructor> GetAllInstructors() { InstructorRepository repository = new InstructorRepository(); var instr = repository.GetAll(); return(instr); }
public void created_course_is_assigned_to_correct_instructor() { //using (var Uow = new MOOCollab2UOW()) using (var Uow = new TestDb()) { //Arrange var courseRepo = new CourseRepository(Uow); var instructorRepo = new InstructorRepository(Uow); var testInstructor = instructorRepo.Find(1); courseRepo.Create(new Course { OwnerId = 1,//course to instructor with Id of one Title = "Test", Resume = "Argh",//test text Status = true }); courseRepo.SaveChanges(); } //using (var Uow = new MOOCollab2UOW()) using (var Uow = new TestDb()) { //Arrange var instructorRepo = new InstructorRepository(Uow); //Act var instructor = instructorRepo.FindAll() .Include(i => i.Courses) .FirstOrDefault(i => i.Id == 1); //assert //Check if instructor has the new course Assert.IsNotNull(instructor.Courses.FirstOrDefault(c => c.Resume == "Argh")); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } StudentRepository.SetConfig(Configuration); CohortRepository.SetConfig(Configuration); InstructorRepository.SetConfig(Configuration); ExerciseRepository.SetConfig(Configuration); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public UnitOfWork(TitanDbContext context) { var sessionId = Guid.NewGuid(); _context = context; Instructors = new InstructorRepository(_context); Courses = new CourseRepository(_context); }
public void AddDepartments(Departments entity) { DepartmentsRepository departmentsRepository = new DepartmentsRepository(); InstructorRepository instructorRepository = new InstructorRepository(); Instructor instructor = instructorRepository.PrintOne(entity.InstructorID); entity.Instructor = instructor; departmentsRepository.Add(entity); }
public void AddInstructor(Instructor entity) { InstructorRepository instructorRepository = new InstructorRepository(); PeopleRepository peopleRepository = new PeopleRepository(); People people = peopleRepository.GetByID(entity.ID); entity.People = people; instructorRepository.Add(entity); }
// GET: Instructor public ActionResult Index() { ContosoContext cc = new ContosoContext(); InstructorRepository ir = new InstructorRepository(cc); InstructorService instructorService = new InstructorService(ir); var instructor = instructorService.GetAllInstructors(); return(View(instructor)); }
public UnitOfWork(ExamContext context) { _context = context; Courses = new CourseRepository(_context); Questions = new QuestionRepository(_context); Exams = new ExamRepository(_context); Students = new StudentRepository(_context); Instructors = new InstructorRepository(_context); }
public UnitOfWork(ApplicationDbContext context, IPropertyMappingService propertyMappingService) { this.context = context; this.propertyMappingService = propertyMappingService; DogRepository = new DogRepository(context, propertyMappingService); InstructorRepository = new InstructorRepository(context); TaskRepository = new TaskRepository(context); TaskEngagementRepository = new TaskEngagementRepository(context); TrainingCourseRepository = new TrainingCourseRepository(context); }
// GET: Instructor public async Task <ActionResult> Index() { IEnumerable <Instructor> instructors = null; using (_instructorRepository = new InstructorRepository()) { instructors = await _instructorRepository.GetListAsync(); } return(View(instructors)); }
public ActionResult Delete(int id, IFormCollection collection) { if (InstructorRepository.DeleteInstructor(id)) { return(RedirectToAction(nameof(Index))); } else { return(RedirectToAction(nameof(Details), new { id = id })); } }
public async Task <IActionResult> Get(int id) { Instructor dbInstructor = await InstructorRepository.GetAsync(id); if (dbInstructor == null) { return(BadRequest()); } return(Ok(dbInstructor)); }
public ActionResult Create(InstructorCreateViewModel viewModel) { try { InstructorRepository.CreateInstructor(viewModel); return(View(viewModel)); } catch { return(View()); } }
public async Task <ActionResult> SpecificInstructor(int id) { IEnumerable <Instructor> result = null; using (_instructorRepository = new InstructorRepository()) { var allInstructors = await _instructorRepository.GetListWithCoursesAsync(); result = from x in allInstructors where x.InstructorID == id select x; } return(View(result.ToList()[0])); }
public ActionResult DeleteConfirmed(int id) { try { InstructorRepository.DeleteInstructor(id); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Details))); } }
public ActionResult Delete(int id) { try { InstructorRepository.DeleteInstructor(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Create(IntructorCreateNewModel model) { try { int id = InstructorRepository.InsertInstructor(model.Instructor); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public async Task <ActionResult> InstructorIndex() { Instructor instructor = null; List <Instructor> res = new List <Instructor>(); using (_instructorRepository = new InstructorRepository()) { ViewBag.Enrollments = await _instructorRepository.GetInstructorEnrollmentsAsync(HttpContext.User.Identity.GetUserId()); instructor = await _instructorRepository.GetAsync(HttpContext.User.Identity.GetUserId()); } return(View(instructor)); }
public UnitOfWork(ApplicationDbContext context) { _context = context; Instructors = new InstructorRepository(_context); InstructorConfigrationKeys = new InstructorConfigrationKeyRepository(_context); Students = new StudentRepository(_context); StudentConfigrationKeys = new StudentConfigrationKeyRepository(_context); ITIBranchs = new ITIBranchRepository(_context); ITIBranchConfigrationKeys = new ITIBranchConfigrationKeyRepository(_context); ITIBranchConfigrations = new ITIBranchConfigrationsRepository(_context); StudentConfigrations = new StudentConfigrationsRepository(_context); InstructorConfigration = new InstructorConfigrationRepository(_context); }
public ActionResult Edit(int id, InstructorEditViewModel viewModel) { try { InstructorRepository.EditInstructor(id, viewModel); return(View(viewModel)); } catch { viewModel.Cohorts = GetAllCohorts(); return(View(viewModel)); } }
public ActionResult Edit(int id, [FromForm] InstructorEditViewModel model) { try { model.instructor.Id = id; InstructorRepository.UpdateInstructor(model.instructor); return(RedirectToAction(nameof(Index))); } catch (Exception) { return(View(model)); } }
public ActionResult Edit(int id, [FromForm] IntructorCreateNewModel instructorModel) { try { InstructorRepository.UpdateInstructor(instructorModel.Instructor); // TODO: Add update logic here return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public RentingService(RentDbContext db) : base() { DbContext = db; Companies = new CompanyRepository(db); Rentals = new RentalRepository(db); Instructors = new InstructorRepository(db); Languages = new LanguageRepository(db); LanguageLevels = new LanguageLevelRepository(db); Tickets = new TicketRepository(db); WageRates = new WageRateRepository(db); Expertises = new ExpertiseRepository(db); ExpertiseLevels = new ExpertiseLevelRepository(db); Courses = new CourseRepository(db); }
static void Main(string[] args) { DbContextOptions <MyDbContext> options = new DbContextOptionsBuilder <MyDbContext>().UseMySql("Server=localhost;Port=3306;Database=weqe;Uid=root;Pwd=parolagelecek;").Options; MyDbContext myDbContext = new MyDbContext(options); IInstructorRepository instructorRepository = new InstructorRepository(myDbContext); Instructor instructor = instructorRepository.FindById(1); System.Console.WriteLine(instructor.FirstName); System.Console.WriteLine(instructor.LastName); System.Console.WriteLine(instructor.Courses[0].Instructor.FirstName); }
public async Task <ActionResult> Delete(int id) { Instructor instructor = await InstructorRepository.GetAsync(id); if (instructor == null) { return(NotFound()); } if (!InstructorRepository.Delete(instructor)) { throw new Exception($"Deleting a instructor {id} failed on save."); } return(NoContent()); }
static void Main(string[] args) { InstructorRepository intructorRepo = new InstructorRepository(); List <string> intructors = instructorRepo.GetIntructors(); var one = "Josh"; var two = "Paul"; var three = "Ransford"; var four = "Kenn"; foreach (string s in intructors) { Console.WriteLine(s); } Console.ReadLine(); }
public UnitOfWork(ActiveLearningContext context) { _context = context; Admins = new AdminRepository(_context); Chats = new ChatRepository(_context); Contents = new ContentRepository(_context); Courses = new CourseRepository(_context); Instructor_Course_Maps = new Instructor_Course_MapRepository(_context); Instructors = new InstructorRepository(_context); QuizAnswers = new QuizAnswerRepository(_context); QuizOptions = new QuizOptionRepository(_context); QuizQuestions = new QuizQuestionRepository(_context); Student_Course_Maps = new Student_Course_MapRepository(_context); Students = new StudentRepository(_context); Users = new UserRepository(_context); }