// 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)); }
public virtual async Task <ActionResult> Create(Subject model) { try { await SubjectCore.CreateAsync(model); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
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)); }
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()); } }
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)); }
// GET: Subject/Delete/5 public virtual async Task <ActionResult> Delete(Guid Id) { var std = await SubjectCore.GetAsync(Id); return(View(std)); }
// GET: Subject public virtual async Task <ActionResult> Index() { var subjects = await SubjectCore.GetAllAsync().ConfigureAwait(false); return(View(subjects)); }