Exemplo n.º 1
0
        public async Task <IActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new BadRequestResult());
            }
            Discipline disc = await _DisciplineRepository.GetByIdAsync(id);

            if (disc == null)
            {
                return(new NotFoundResult());
            }
            ViewBag.Lectures      = new MultiSelectList(_LecturerRepository.GetAll(), "Id", "Name", disc.Lectors.Select(l => l.Id).ToList());
            ViewBag.Instructions  = _StorageService.GetAllFiles("instructions").Select(w => w.Name).ToList();
            ViewBag.WorkSchedules = _StorageService.GetAllFiles("workschedule").Select(w => w.Name).ToList();
            return(View(disc));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a discipline by its ID.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Discipline with a given ID.</returns>
        public async Task <Discipline> GetDisciplineByIdAsync(int id)
        {
            var d = await _repo.GetByIdAsync(id);

            return(d);
        }