Exemplo n.º 1
0
        // GET: Student
        public virtual async Task <ActionResult> Index()
        {
            ViewBag.Subjects = await SubjectCore.GetAllAsync().ConfigureAwait(false);

            ViewBag.Student = await StudentCore.GetAllAsync().ConfigureAwait(false);

            var students = await StudentCore.GetAllAsync(new[] {
                nameof(Student.Subjects)
            }).ConfigureAwait(false);

            return(View(students));
        }
Exemplo n.º 2
0
        public virtual async Task <ActionResult> Create(Subject model)
        {
            try
            {
                await SubjectCore.CreateAsync(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public virtual async Task <ActionResult> GetStudentsBySubjectId(Guid subjectId)
        {
            var currentSubject = await SubjectCore.GetAsync(subjectId, new[] {
                nameof(Subject.Students)
            }).ConfigureAwait(false);

            var studentsForCurrentSubject = currentSubject.Students.ToList();


            ViewBag.AllStudents = studentsForCurrentSubject;

            return(View("_studentList", studentsForCurrentSubject));
        }
Exemplo n.º 4
0
        public virtual async Task <ActionResult> Delete(Guid Id, Subject model)
        {
            try
            {
                await SubjectCore.GetAsync(Id);

                await SubjectCore.DeleteAsync(model);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 5
0
        public virtual async Task <ActionResult> Filter(Guid?SubjectId)
        {
            ViewBag.Subject = await SubjectCore.GetAllAsync().ConfigureAwait(false);

            ViewBag.AllStudents = await StudentCore.GetAllAsync().ConfigureAwait(false);

            var model = await SubjectCore.GetFiltered(navigationProperties : new[] {
                nameof(Subject.Students)
            }).ConfigureAwait(false);

            if (model == null)
            {
                return(View());
            }
            if (SubjectId != null && SubjectId != Guid.Empty)
            {
                ViewBag.ShiftIdToOpenInDialog = SubjectId.Value;
            }

            ViewBag.SubjectList      = model.EntityContainers.First().Data;
            ViewBag.TotalShiftsCount = model.TotalItems;
            return(View(model));
        }
Exemplo n.º 6
0
        // GET: Subject/Delete/5
        public virtual async Task <ActionResult> Delete(Guid Id)
        {
            var std = await SubjectCore.GetAsync(Id);

            return(View(std));
        }
Exemplo n.º 7
0
        // GET: Subject
        public virtual async Task <ActionResult> Index()
        {
            var subjects = await SubjectCore.GetAllAsync().ConfigureAwait(false);

            return(View(subjects));
        }