@page @using global::c3stream.DataModels @model InfoModel @{ ViewData["Title"] = "Info"; } @{ if (string.IsNullOrWhiteSpace(Request.Query["guid"]) || c3stream.GetEventByGuid(Request.Query["guid"]) == null) { Response.Redirect("/"); return; } var cookie = c3stream.UpdateCookie(Request, Response, $"/Info?guid={Request.Query["guid"]}"); await using var db = new Database.DbConn(); var talk = c3stream.GetEventByGuid(Request.Query["guid"]); var state = db.States.FirstOrDefault(p => p.TalkId == Request.Query["guid"].ToString() && p.UserId == cookie)?.State; if (talk == null) { Response.Redirect("/"); return; } if (state == null) { state = "unwatched"; } var title = talk.Title; var speakers = talk.Persons.Any() ? talk.Persons.Aggregate((s, s1) => $"{s}, {s1}") : ""; var description = talk.Description; if (string.IsNullOrEmpty(description)) { description = "<missing description>"; } var isWatched = state == "watched"; var isMarked = state == "marked"; var file = $"{talk.Slug}.mp4"; var conference = c3stream.GetConferenceByEventGuid(talk.Guid); var eventName = talk.Tags.Count <= 1 ? conference.Acronym : talk.Tags[0]; var logoPath = System.IO.Path.Combine(c3stream.CachePath, conference.Acronym, "logo.png"); var category = talk.Tags.Count switch { 0 => "", 1 => talk.Tags[0], 2 => "", 3 => talk.Tags[2], 4 => talk.Tags[3], 5 => talk.Tags[3], 6 => talk.Tags[3], // rc3: is this correct? _ => "" }; } @if (System.IO.File.Exists(logoPath)) { Conference logo } else { Conference logo } @if (isWatched) {

@title - @speakers

} else if (isMarked) {

@title - @speakers

} else {

@title - @speakers

}
@eventName - @category - @talk.Date?.Date.ToShortDateString()
@if (System.IO.File.Exists(System.IO.Path.Combine(c3stream.CachePath, conference.Acronym, file))) { } else { } @if (isWatched) { } else if (isMarked) { } else { }

@Html.Raw(description.Replace("\n", "
").Replace("

", "").Replace("

", ""))

Share this talk:
https://@Request.Host.Value/Info?guid=@Request.Query["guid"]