public ActionResult Create()
        {
            ViewBag.CourseId = new SelectList(_courseRepository.GetAll(), "Id", "CourseTitle");

            ViewBag.InstructorId = new SelectList(_instructorRepository.GetAll(), "Id", "InstructorName");

            return(View());
        }
Example #2
0
 public IActionResult Index()
 {
     ViewBag.InstructorEditId   = TempData["InstructorEditId"];
     ViewBag.InstructorCreateId = TempData["InstructorCreateId"];
     ViewBag.InstructorChangeId = TempData["InstructorChangeId"];
     return(View(repository.GetAll()));
 }
Example #3
0
 public List <InstructorDto> GetAll()
 {
     using (_instructorRepository)
     {
         var instructorList = _instructorRepository.GetAll().ToList();
         return(instructorList.Select(x => x.ConvertToInstructorDto()).ToList());
     }
 }
Example #4
0
        public async Task <IActionResult> getInstructors()
        {
            var queryResult = await instructorRepository.GetAll();

            var response = mapper.Map <QueryResult <Instructor>, QueryResultResource <InstructorResource> >(queryResult);

            return(Ok(response));
        }
Example #5
0
        public FitnessClassDetailsDTO Get(int id)
        {
            FitnessClass           FitnessClass = IFitnessClassRepository.Get(id);
            FitnessClassDetailsDTO MyClass      = new FitnessClassDetailsDTO()
            {
                Name = FitnessClass.Name,
                Img  = FitnessClass.Img
            };

            IEnumerable <InstructorFitnessClass> MyInstructorClasses = IInstructorClassRepository.GetAll().Where(x => x.FitnessClassId == FitnessClass.Id);

            if (MyInstructorClasses != null)
            {
                List <string> InstructorNameList = new List <string>();
                foreach (InstructorFitnessClass MyInstructorClass in MyInstructorClasses)
                {
                    Instructor MyInstructor = IInstructorRepository.GetAll().SingleOrDefault(x => x.Id == MyInstructorClass.InstructorId);
                    InstructorNameList.Add(MyInstructor.FirstName + " " + MyInstructor.LastName);
                }
                MyClass.InstructorName = InstructorNameList;
            }


            IEnumerable <GymClubFitnessClass> MyGymClubClasses = IGymClubClassRepository.GetAll().Where(x => x.FitnessClassId == FitnessClass.Id);

            if (MyGymClubClasses != null)
            {
                List <string> GymClubNameList = new List <string>();
                foreach (GymClubFitnessClass MyGymClubClass in MyGymClubClasses)
                {
                    GymClub MyGymClub = IGymClubRepository.GetAll().SingleOrDefault(x => x.Id == MyGymClubClass.GymClubId);
                    GymClubNameList.Add(MyGymClub.Name);
                }
                MyClass.GymClubName = GymClubNameList;
            }

            IEnumerable <Song> MySongs = ISongRepository.GetAll().Where(x => x.FitnessClassId == FitnessClass.Id);

            if (MySongs != null)
            {
                List <string> SongNameList = new List <string>();
                foreach (Song MySong in MySongs)
                {
                    SongNameList.Add(MySong.Name);
                }
                MyClass.SongName = SongNameList;
            }

            return(MyClass);
        }
Example #6
0
        public static void LoadInstructors(DataGridView dgvInstructors, IInstructorRepository repository)
        {
            dgvInstructors.Rows.Clear();

            foreach (var instructor in repository.GetAll())
            {
                var index = dgvInstructors.Rows.Add(
                    instructor.FirstName,
                    instructor.LastName,
                    instructor.Phone);

                dgvInstructors.Rows[index].Tag = instructor;
            }
        }
Example #7
0
        private void GenerateExamApplication_Load(object sender, EventArgs e)
        {
            lblCandidateInfo.Text    = $"{lblCandidateInfo.Text} {_info.FirstName} {_info.LastName}";
            cbxExamDay.SelectedIndex = 0;

            object[] items = _instructorRepository.GetAll().Select(x => $"{x.FirstName} {x.LastName}").ToArray();
            if (!items.Any())
            {
                return;
            }

            cbxInstructors.Items.AddRange(items);
            cbxInstructors.SelectedIndex = 0;
        }
Example #8
0
        public async Task <DataResponse <Instructor> > GetAll()
        {
            try
            {
                DataResponse <Instructor> response = await _InstructorRepo.GetAll();

                return(response);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString());
                DataResponse <Instructor> r = new DataResponse <Instructor>()
                {
                    Success = false
                };
                r.ErrorList.Add("Error on read Instructors");
                return(r);
            }
        }
Example #9
0
        public IActionResult List()
        {
            try
            {
                var output = _instructorRepository.GetAll();

                if (output.Count() > 0)
                {
                    return(Ok(output));
                }
                else
                {
                    return(Ok(new GenericResult {
                        Response = true, Message = "Instructor Record is empty"
                    }));
                }
            } catch (Exception e) {
                return(BadRequest(e));
            }
        }
 public void InstructorList()
 {
     ViewBag.Instructors = _instructorRepository.GetAll();
 }
 // 0
 public void InstructorList()
 {
     //ViewBag.Instructors = _instructorRepository.GetAll();
     ViewBag.Instructors = new SelectList(_instructorRepository.GetAll(), "InstructorId", "FullName");
 }
 public List <Instructor> GetAllInstructors()
 {
     return((List <Instructor>)Instructors.GetAll());
 }
Example #13
0
 public IEnumerable <Instructor> GetAllInstructors()
 {
     return(instructorRepository.GetAll());
 }
 public IActionResult Index()
 {
     return(View(repo.GetAll()));
 }
 public IEnumerable <models.Instructor> GetAll()
 {
     return(_instructorRepository.GetAll());
 }
Example #16
0
 public IActionResult Create()
 {
     ViewBag.Instructors = _instructorRepository.GetAll();
     return(View());
 }
Example #17
0
 public IActionResult Index()
 {
     return(View(_repository.GetAll()));
 }
 public ActionResult <IEnumerable <Instructor> > Get()
 {
     return(IInstructorRepository.GetAll());
 }