Exemplo n.º 1
0
        public IHttpActionResult GetCohort(int id)
        {
            CohortService cohortService = CreateCohortService();
            var           cohorts       = cohortService.GetCohortById(id);

            return(Ok(cohorts));
        }
        // GET: HelpQueue/HelpQueue/{id?}
        public async Task <ActionResult> Queue(int?id)
        {
            var service = new CohortService(User.Identity.GetUserId());

            CohortDetail model = null;

            if (User.IsInRole("Student"))
            {
                model = await service.GetUserCohortDetailAsync(User.Identity.GetUserId());

                if (model is null)
                {
                    return(RedirectToAction(nameof(InactiveAccount)));
                }
            }
            else if (id.HasValue)
            {
                model = await service.GetCohortById(id.Value);
            }

            if (model is null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            return(View(model));
        }