Esempio n. 1
0
        public async Task<ActionResult> CurrentStudents(int classId)
        {
            var @class = await db.Classes.FindAsync(classId);
            if(@class == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Format("No class with id {0}", classId));
            }

            EnrollmentManager manager = new EnrollmentManager(db);
            var currentStudents = await manager.GetAcceptedEnrollmentsForClass(@class);

            ViewBag.Class = @class;
            return View(currentStudents);
        }
Esempio n. 2
0
        public async Task<ActionResult> UpdateWaitlist(string username, int classId, bool accept)
        {
            if(username == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            List<EnrollmentBindingModel> updates = new List<EnrollmentBindingModel>
            {
                new EnrollmentBindingModel { Accept = accept, ClassId = classId, StudentUserName = username }
            };

            EnrollmentManager manager = new EnrollmentManager(db);
            await manager.AcceptEnrollment(updates);

            return RedirectToAction("Waitlist", new { classId = classId });
        }
Esempio n. 3
0
 /// <summary>
 /// Create a new default EnrollmentsController
 /// </summary>
 public EnrollmentsController()
 {
     _db = new ApplicationDbContext();
     _enrollmentManager = new EnrollmentManager(_db);
     _userManager = new ApplicationUserManager(new UserStore<ApplicationUser>(_db));
 }