public async Task <ActionResult> PostEvent(SaveEventDTO eventDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                //mapping object
                var eventobj = _mapper.Map <SaveEventDTO, Event>(eventDTO);

                //id aanmaken - gaat automatisch
                //eventobj.Id = Guid.NewGuid();

                //save object
                await _context.AddAsync(eventobj);


                //--------------welke url meegeven??????-----------------------
                return(Created("", eventobj));
            }
            catch (Exception ex)
            {
                _logger.LogCritical($"Kon object niet saven: {eventDTO} Warning: {ex}");
                return(BadRequest("Couldn't save your event"));
            }
        }
        public async Task <ActionResult> Create(Event eventobj)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", "Kan evenement niet toevoegen, Gelieve de velden te controleren.");
                    return(View());
                }

                await eventRepo.AddAsync(eventobj);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                Debug.WriteLine("fout bij create" + ex);
                return(View());
            }
        }
 public async Task <Event> PostEvent(Event e)
 {
     return(await _eventRepo.AddAsync(e));
 }