| | 1 | | @inject Services.UserConferenceAuthService conferenceAuthService |
| | 2 | |
|
| | 3 | | @inject MunityContext dbContext |
| | 4 | |
|
| | 5 | |
|
| 0 | 6 | | @if (footer == null) |
| 0 | 7 | | { |
| 0 | 8 | | @if (dbContext.Conferences.Any(n => n.ConferenceId == ConferenceId)) |
| 0 | 9 | | { |
| | 10 | | <div class="row"> |
| | 11 | | <p>Es sieht so aus, als wurde noch kein Footer für die Webseite angelegt.</p> |
| | 12 | | <button class="btn btn-primary" @onclick=CreateFooter>Einen Footer erstellen</button> |
| | 13 | | </div> |
| 0 | 14 | | } |
| | 15 | | else |
| 0 | 16 | | { |
| 0 | 17 | | <p>The conference with id @ConferenceId was not found.</p> |
| 0 | 18 | | } |
| 0 | 19 | | } |
| | 20 | | else |
| 0 | 21 | | { |
| | 22 | | <div class="row"> |
| 0 | 23 | | @if (editMode) |
| 0 | 24 | | { |
| | 25 | | <div class="form-group"> |
| | 26 | | <label>Inhalt</label> |
| | 27 | | <RadzenHtmlEditor @bind-Value=@footer.FooterContent /> |
| | 28 | | </div> |
| | 29 | | <div class="form-group"> |
| | 30 | | <button class="btn btn-primary" @onclick=Save>Speichern</button> |
| | 31 | | </div> |
| 0 | 32 | | } |
| | 33 | | else |
| 0 | 34 | | { |
| 0 | 35 | | <p>@((MarkupString)footer.FooterContent) <a class="cursor-pointer" @onclick="() => editMode = true">bearbeit |
| 0 | 36 | | } |
| | 37 | |
|
| | 38 | | </div> |
| | 39 | |
|
| 0 | 40 | | } |
| | 41 | |
|
| | 42 | |
|
| | 43 | | @code { |
| 0 | 44 | | [Parameter] public string ConferenceId { get; set; } |
| | 45 | |
|
| | 46 | | private MUNity.Database.Models.Website.ConferenceWebsiteFooter footer; |
| | 47 | |
|
| 0 | 48 | | private bool editMode = false; |
| | 49 | |
|
| | 50 | | protected override async Task OnParametersSetAsync() |
| 0 | 51 | | { |
| 0 | 52 | | await base.OnParametersSetAsync(); |
| 0 | 53 | | this.footer = await dbContext.ConferenceWebsiteFooters.FirstOrDefaultAsync(n => n.ConferenceId == ConferenceId); |
| | 54 | |
|
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | private async Task Save() |
| 0 | 58 | | { |
| 0 | 59 | | await dbContext.SaveChangesAsync(); |
| 0 | 60 | | this.editMode = false; |
| 0 | 61 | | } |
| | 62 | |
|
| | 63 | | private async Task CreateFooter() |
| 0 | 64 | | { |
| 0 | 65 | | this.footer = new MUNity.Database.Models.Website.ConferenceWebsiteFooter() |
| 0 | 66 | | { |
| 0 | 67 | | ConferenceId = ConferenceId, |
| 0 | 68 | | }; |
| 0 | 69 | | dbContext.ConferenceWebsiteFooters.Add(footer); |
| 0 | 70 | | await dbContext.SaveChangesAsync(); |
| 0 | 71 | | } |
| | 72 | | } |