From 7f9d0e946b9c42c199207044b7f1006babbe7736 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 19 Jan 2017 14:32:03 +0100 Subject: [PATCH] refactoring --- Yavsc/Controllers/CircleController.cs | 3 +-- Yavsc/Controllers/CircleMemberController.cs | 3 +-- Yavsc/ViewModels/Auth/FileSpotInfo.cs | 5 ++-- .../Auth/Handlers/PostUserFileHandler.cs | 1 + Yavsc/Views/FrontOffice/Book.cshtml | 2 +- .../DisplayTemplates/ApplicationUser.cshtml | 21 ++++++++++++++++ .../DisplayTemplates/PerformerProfile.cshtml | 24 ++----------------- 7 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml diff --git a/Yavsc/Controllers/CircleController.cs b/Yavsc/Controllers/CircleController.cs index b1bc133d..f439d762 100644 --- a/Yavsc/Controllers/CircleController.cs +++ b/Yavsc/Controllers/CircleController.cs @@ -1,7 +1,6 @@ -using System.Linq; + using System.Threading.Tasks; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Data.Entity; using Yavsc.Models; using Yavsc.Models.Relationship; diff --git a/Yavsc/Controllers/CircleMemberController.cs b/Yavsc/Controllers/CircleMemberController.cs index de14f13a..bc8f76ea 100644 --- a/Yavsc/Controllers/CircleMemberController.cs +++ b/Yavsc/Controllers/CircleMemberController.cs @@ -1,7 +1,6 @@ -using System.Linq; + using System.Threading.Tasks; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Data.Entity; using Yavsc.Models; using Yavsc.Models.Relationship; diff --git a/Yavsc/ViewModels/Auth/FileSpotInfo.cs b/Yavsc/ViewModels/Auth/FileSpotInfo.cs index 78c079ca..1f1abf2b 100644 --- a/Yavsc/ViewModels/Auth/FileSpotInfo.cs +++ b/Yavsc/ViewModels/Auth/FileSpotInfo.cs @@ -3,11 +3,12 @@ using System.IO; using Microsoft.AspNet.Authorization; using Yavsc.Models; -namespace Yavsc { +namespace Yavsc.ViewModel.Auth { public class FileSpotInfo : IAuthorizationRequirement { - public DirectoryInfo PathInfo { get; private set; } + public DirectoryInfo PathInfo { get; private set; } + public FileSpotInfo(string path, Blog b) { PathInfo = new DirectoryInfo(path); AuthorId = b.AuthorId; diff --git a/Yavsc/ViewModels/Auth/Handlers/PostUserFileHandler.cs b/Yavsc/ViewModels/Auth/Handlers/PostUserFileHandler.cs index e72a3461..d03f39fc 100644 --- a/Yavsc/ViewModels/Auth/Handlers/PostUserFileHandler.cs +++ b/Yavsc/ViewModels/Auth/Handlers/PostUserFileHandler.cs @@ -1,5 +1,6 @@ using System.Security.Claims; using Microsoft.AspNet.Authorization; +using Yavsc.ViewModel.Auth; namespace Yavsc.ViewModels.Auth.Handlers { diff --git a/Yavsc/Views/FrontOffice/Book.cshtml b/Yavsc/Views/FrontOffice/Book.cshtml index 9acda2a1..33a8c4aa 100644 --- a/Yavsc/Views/FrontOffice/Book.cshtml +++ b/Yavsc/Views/FrontOffice/Book.cshtml @@ -7,7 +7,7 @@ @foreach (var profile in Model) {
- await Html.RenderPartialAsync("PerformerProfile", profile) ; + @Html.DisplayFor(m=>m)
diff --git a/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml b/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml new file mode 100644 index 00000000..d7e5cb4e --- /dev/null +++ b/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml @@ -0,0 +1,21 @@ +@model ApplicationUser +blah +avatar +@Model.UserName + @if (Model.Posts!=null) { +
  • @SR["His blog"] +
  • + } + @if (!string.IsNullOrEmpty( + Model.DedicatedGoogleCalendar)) + { +
  • @SR["Exposes his Google calendar!"] +
  • + } + @if (Model.Devices?.Count>0) + { +
  • @SR["Uses the mobile application, and receives push notifications"] +
  • + } + } diff --git a/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml b/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml index 58f82668..7be85db3 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml @@ -2,9 +2,7 @@
    - avatar - - @Model.Performer?.UserName + @Html.DisplayFor(m=>m.Performer)
    • @SR["Rating"]: @Model.Rate %
    • @@ -17,25 +15,7 @@ @if (Model.WebSite!=null) {
    • @SR["WebSite"]: @Model.WebSite
    • } - @if (Model.Performer != null) { - @if (Model.Performer.Posts!=null) { -
    • @SR["His blog"] -
    • - } - @if (!string.IsNullOrEmpty( - Model.Performer.DedicatedGoogleCalendar)) - { -
    • @SR["Exposes his Google calendar!"] -
    • - } - @if (Model.Performer.Devices?.Count>0) - { -
    • @SR["Uses the mobile application, and receives push notifications"] -
    • - } - } - +