예제 #1
0
        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));
            }
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
 public async Task <IList <Poll> > GetAllPolls()
 {
     return(await _pollRepository.GetAllPolls());
 }
예제 #4
0
 public List <Poll> GetAllPolls()
 {
     return(_pollRepository.GetAllPolls());
 }