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)); }
// GET: Event public async Task <ActionResult> Index() { var events = await eventRepo.GetAllAsync(); return(View(events)); }
// GET: Admin public async Task <ActionResult> IndexAsync() { var result = await eventRepo.GetAllAsync(); return(View(result)); }