public async Task <IActionResult> ExportNonProcessed()
        {
            var polaganja = User.IsInRole(SD.AdminEndUser)
                ? await _polaganja.GetNonProcessedRequests()
                : await _polaganja.GetNonProcessedRequests(await _kandidati.GetIdByEmail(User.Identity.Name));

            return(await WritePolaganja(polaganja));
        }
        //GET: Index
        public async Task <IActionResult> Index(string firstAttribute = null, string option = null, string search = null)
        {
            PolaganjasView polaganjasView = new PolaganjasView()
            {
                Statusi = _context.StatusPrijave.ToList()
            };


            if (!User.IsInRole(SD.AdminEndUser))
            {
                int kandidatID = await _kandidat.GetIdByEmail(User.Identity.Name);

                polaganjasView.NonProcessed = await _polaganja.GetNonProcessedRequests(kandidatID);

                polaganjasView.Processed = await _polaganja.GetProcessedRequests(kandidatID);
            }
            else
            {
                polaganjasView.NonProcessed = await _polaganja.GetNonProcessedRequests(firstAttribute, option, search);

                polaganjasView.Processed = await _polaganja.GetProcessedRequests(firstAttribute, option, search);
            }

            return(View(polaganjasView));
        }
Example #3
0
        public async Task <IActionResult> Details(int?id)
        {
            int?kandidatId = id;

            if (User.IsInRole(SD.AdminEndUser) && kandidatId == null)
            {
                return(NotFound());
            }

            if (User.IsInRole(SD.CandidatEndUSer))
            {
                kandidatId = await _kandidat.GetIdByEmail(User.Identity.Name);
            }

            var kandidat = await _kandidat.GetKandidat((int)kandidatId);

            if (kandidat == null)
            {
                return(NotFound());
            }

            KandidatsAndExams ke = new KandidatsAndExams
            {
                Kandidat         = kandidat,
                PolozeniIspiti   = await _polaganja.GetCompletedExams((int)kandidatId),
                NepolozeniIspiti = await _ispit.GetNepolozeniIspiti((int)kandidatId)
            };

            return(View(ke));
        }