@page
@using Models;
@using System.Security.Claims;
@model WebApp.Pages.EventsModel
@{
    ViewData["Title"] = "Events";
    List<Event> events = ((List<Event>)ViewData["events"]).ToList();
}

<a href="./EditEvent" class="btn btn-primary">Create new event</a>

<div class="mb-3 mt-3">
    @foreach (Event _event in events)
    {
        <div class="card" style="display:inline-flex; width: 18rem;">
            <div class="card-body">
                <h5 class="card-title">@_event.Title</h5>
                <h6 class="card-subtitle mb-2 text-muted">@_event.StartDate.ToString("g") - @_event.EndDate.ToString("g")</h6>
                <h6 class="card-subtitle mb-2 text-muted">@_event.Author.Name</h6>
                <p class="card-text">@_event.Description.PadRight(100).Substring(0,100).Trim()</p>
                <a href="./Event?id=@_event.ID" class="btn btn-primary">More details</a>
            </div>
        </div>
    }
</div>