public ActionResult <IEnumerable <PollDto> > GetAllPolls() { try { var polls = _repository.GetAllPolls(); return(Ok(_mapper.Map <IEnumerable <PollDto> >(polls))); } catch (Exception e) { return(StatusCode(500, "Poll listing error: " + e)); } }
public async Task <IActionResult> Index() { ApplicationUser au = context.ApplicationUsers.Single(au => au.Email == User.Identity.Name); var flag = await SignInManager.UserManager.IsInRoleAsync(au, "Admin"); if (flag) { return(LocalRedirect("/Admin/Index")); } else { var model = _pollRepo.GetAllPolls(context.ApplicationUsers.Single(au => au.Email == User.Identity.Name).Id); return(View(model)); } }
public async Task <IList <Poll> > GetAllPolls() { return(await _pollRepository.GetAllPolls()); }
public List <Poll> GetAllPolls() { return(_pollRepository.GetAllPolls()); }