public async Task <IActionResult> DeleteEventAsync([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!EventExists(id)) { return(NotFound()); } var @event = await eventsRepository.DeleteAsync(id); return(Ok(@event.ToViewModel())); }