コード例 #1
0
        public async Task <IActionResult> GetEvents()
        {
            //vanuit repo Lijst (IEnumerable) ophalen alle events
            IEnumerable <Event> events = await _context.GetAllAsync();

            //mapping van Domain class naar DTO object - API resource
            List <EventDTO> eventDTO = _mapper.Map <List <Event>, List <EventDTO> >(events.ToList());

            //geef een ok result met het object terug
            return(Ok(eventDTO));
        }
コード例 #2
0
        // GET: Event
        public async Task <ActionResult> Index()
        {
            var events = await eventRepo.GetAllAsync();

            return(View(events));
        }
コード例 #3
0
        // GET: Admin
        public async Task <ActionResult> IndexAsync()
        {
            var result = await eventRepo.GetAllAsync();

            return(View(result));
        }