public async Task <ActionResult <Event> > DeleteEvent(Guid id) { try { //ophalen object var eventobj = await _context.GetAsync(id); //indien null == not found if (eventobj == null) { return(NotFound()); } //verwijder object await _context.DeleteAsync(eventobj); //toon succes melding return(NoContent()); } catch (Exception) { _logger.LogCritical($"event not deleted: {id}"); return(BadRequest("Kon voorlopig data niet verwijderen")); } }
public async Task <ActionResult> Delete(Guid id, Event eventobj) { try { // TODO: Add delete logic here await eventRepo.DeleteAsync(eventobj); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { Debug.WriteLine("fout bij delete" + ex); return(View()); } }