Exemplo n.º 1
0
        public async Task <ActionResult> IndexAsync()
        {
            try
            {
                var result = await _examsRepository.GetAll();

                if (result.Item1)
                {
                    if (TempData["SuccessResultF"] != null)
                    {
                        ViewBag.Notification = new SuccessResult((bool)TempData["SuccessResultF"], (string)TempData["SuccessResultM"]);
                    }
                    return(View(result.Item2));
                }
                else
                {
                    TempData["SuccessResultF"] = false;
                    TempData["SuccessResultM"] = "You are not logged in!";
                    return(RedirectToAction("Login", "Home"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetExamsAsync()
        {
            var examItems = await _context.GetAll();

            _log.AddLog(Request, _httpContextAccessor, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), "Eshte nxjerrur lista e provimeve");
            return(Ok(_mapper.Map <IEnumerable <ReadExamDTO> >(examItems)));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetExamsAsync()
        {
            var examItems = await _context.GetAll();

            return(Ok(_mapper.Map <IEnumerable <ReadExamDto> >(examItems)));
        }