diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index b5f0c15..e25d643 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -1,10 +1,144 @@ @page +@using System.Security.Claims +@using robert_brands_com.Models @model IndexModel @{ - ViewData["Title"] = "Home page"; + ViewData["Title"] = "Robert Brands"; } -
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

+
+
+
+ +
+
+
+
+
+
+

Kontakt

+

Robert Brands

+

+ +

+
+
+
+
+
+
+

Office

+

+

+

+
+
+
+
+
+
+

OOF - Out of office

+

+

+

+
+
+
+
+
+
+ @if (Model.Headline != null) + { +

+ @Model.Headline.Title + @if (User.IsInAnyRole(KnownRoles.Admin)) + { + + + + } +

+
+ @Html.Raw(Model.Headline.ArticleContent) +
+ } + else if (User.IsInAnyRole(KnownRoles.Admin)) + { +
+ + + +
+ } + +
+
+
+
+
+ +@section Scripts { + +} + diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs index d849e0a..304b4ce 100644 --- a/Pages/Index.cshtml.cs +++ b/Pages/Index.cshtml.cs @@ -6,22 +6,33 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; +using robert_brands_com.Models; +using robert_brands_com.Repositories; namespace robert_brands_com.Pages { [AllowAnonymous] public class IndexModel : PageModel { - private readonly ILogger _logger; + private const string listName = "Titel"; + private ICosmosDBRepository
repository; + const string NewsList = "Homepage"; + private ICosmosDBRepository photoRepository; - public IndexModel(ILogger logger) + public Article Headline { get; set; } + public IEnumerable PhotoList { get; private set; } + public int PhotoLinkOffset { get; set; } + + public IndexModel(ICosmosDBRepository repositoryService, ICosmosDBRepository
blogRepository) { - _logger = logger; + repository = blogRepository; + photoRepository = repositoryService; } - - public void OnGet() + public async Task OnGetAsync() { - + Headline = await this.repository.GetDocumentByKey("homepage-headline"); + IEnumerable documents = await photoRepository.GetDocuments(d => d.ListName == listName); + PhotoList = documents.OrderByDescending(d => d.Date); } } } diff --git a/Pages/Shared/_Layout.cshtml b/Pages/Shared/_Layout.cshtml index 2fcac49..6b064f4 100644 --- a/Pages/Shared/_Layout.cshtml +++ b/Pages/Shared/_Layout.cshtml @@ -4,7 +4,7 @@ - + @if (!String.IsNullOrEmpty(ViewBag.Keywords ?? String.Empty)) { @@ -41,7 +41,7 @@
-
-
-
+
@RenderBody()
-