public async Task <IActionResult> PutEvent(Guid id, EventDTO eventDTO)
        {
            //checken of de state van de eventDTO wel valid is
            if (!ModelState.IsValid)
            {
                _logger.LogCritical("event not valid");
                return(BadRequest(ModelState));
            }


            if (id != eventDTO.Id)
            {
                return(BadRequest());
            }

            var eventobj = _mapper.Map <EventDTO, Event>(eventDTO);

            try
            {
                await _context.UpdateAsync(eventobj);

                _logger.LogInformation($"event updated: {eventobj}");
            }
            catch (Exception ex)
            {
                _logger.LogCritical($"Couldn't update event: {eventobj} exeption:  {ex}");

                //vraag aan docent welke error bij het mislukken van update
                return(BadRequest("Couldn't update your data"));
            }
            //statuscode 204 returnen indien gelukt
            return(NoContent());
        }
        public async Task <ActionResult> Edit(Guid id, Event eventobj)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", "Edit kon niet uitgevoerd worden!");
                    return(View());
                }
                // TODO: Add update logic here
                await eventRepo.UpdateAsync(eventobj);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                Debug.WriteLine("fout bij edit" + ex);
                return(View());
            }
        }
 public async Task <Event> PutEvent(int id, Event e)
 {
     return(await _eventRepo.UpdateAsync(id, e));
 }