mirror of https://github.com/abpframework/eventhub
16 changed files with 250 additions and 100 deletions
@ -0,0 +1,10 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EventHub.Members |
|||
{ |
|||
public interface IMemberAppService : IApplicationService |
|||
{ |
|||
Task<UserDto> FindByUserNameAsync(string username); |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Auditing; |
|||
|
|||
namespace EventHub.Members |
|||
{ |
|||
public class UserDto : EntityDto<Guid>, IHasCreationTime |
|||
{ |
|||
public string UserName { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string Surname { get; set; } |
|||
|
|||
public string Email { get; set; } |
|||
|
|||
public DateTime CreationTime { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Users; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace EventHub.Members |
|||
{ |
|||
public class MemberAppService : EventHubAppService, IMemberAppService |
|||
{ |
|||
private readonly IRepository<AppUser, Guid> _userRepository; |
|||
|
|||
public MemberAppService(IRepository<AppUser, Guid> userRepository) |
|||
{ |
|||
_userRepository = userRepository; |
|||
} |
|||
|
|||
public async Task<UserDto> FindByUserNameAsync(string username) |
|||
{ |
|||
var user = await _userRepository.FindAsync(x => x.UserName == username); |
|||
|
|||
return ObjectMapper.Map<AppUser, UserDto>(user); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,119 @@ |
|||
@page |
|||
@using System.Globalization |
|||
@using EventHub.Web.Pages.Events.Components.EventsArea |
|||
@using EventHub.Web.Pages.Organizations.Components.OrganizationsArea |
|||
@using Volo.Abp.Timing |
|||
@using Volo.Abp.Users |
|||
@inject ICurrentUser CurrentUser |
|||
@inject IClock Clock |
|||
@model EventHub.Web.Pages.Members.ProfileModel |
|||
<div class="container pt-4"> |
|||
<div class="row py-4"> |
|||
<div class="col-md-2"> |
|||
<div class=""> |
|||
<ul class="card list-group"> |
|||
<div class="card-body"> |
|||
<div class="text-center"> |
|||
<div> |
|||
<div class="profile-pic"> |
|||
<div class="position-relative d-inline-block mx-auto"> |
|||
<img gravatar-email="@Model.User.Email" default-image="Wavatar" gravatar-size="80" class="avatar rounded-circle"/> |
|||
</div> |
|||
</div> |
|||
@if (Model.User.Name != null && Model.User.Surname != null) |
|||
{ |
|||
<h4 class="m-0 mt-4">@Model.User.Name @Model.User.Surname</h4> |
|||
} |
|||
|
|||
</div> |
|||
<div class="mt-4"> |
|||
<small class="text-muted text-uppercase">UserName</small> |
|||
<h4 class="m-0">@Model.User.UserName</h4> |
|||
</div> |
|||
|
|||
<div class="mt-4"> |
|||
<small class="text-muted text-uppercase">Registration Date</small> |
|||
<h5 class="m-0">@Model.User.CreationTime.ToString(CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern)</h5> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-10"> |
|||
<ul class="nav nav-tabs profile-nav" id="profileTab"> |
|||
<li class="nav-item"> |
|||
<a href="#Organizations" class="nav-link active" data-toggle="tab">Organizations</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a href="#AttendedEvents" class="nav-link" data-toggle="tab">Attended Events</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a href="#UpcomingEvents" class="nav-link" data-toggle="tab">Upcoming Events</a> |
|||
</li> |
|||
</ul> |
|||
<div class="tab-content profile-content py-4"> |
|||
<div id="Organizations" class="tab-pane fade show active"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<div class="card"> |
|||
<div class="card-body" style="min-height: 496px"> |
|||
<div> |
|||
<h3 class="mb-4">Ownered Organizations</h3> |
|||
<partial name="~/Pages/Organizations/Components/OrganizationsArea/_organizationListSection.cshtml" model="@Model.Organizations"/> |
|||
</div> |
|||
<div> |
|||
<h3 class="mb-4">Membership Organizations</h3> |
|||
@await Component.InvokeAsync(typeof(OrganizationsAreaViewComponent), new |
|||
{ |
|||
registeredUserId = Model.User.Id, |
|||
maxResultCount = 6 |
|||
}) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div id="AttendedEvents" class="tab-pane fade"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<div class="card"> |
|||
<div class="card-body" style="min-height: 496px"> |
|||
<h3 class="mb-4">Attended Events</h3> |
|||
<div class="past-events"> |
|||
@await Component.InvokeAsync(typeof(EventsAreaViewComponent), new |
|||
{ |
|||
maxDate = Clock.Now.ClearTime(), |
|||
registeredUserId = Model.User.Id, |
|||
maxResultCount = 6, |
|||
skipCount = 0 |
|||
}) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div id="UpcomingEvents" class="tab-pane fade"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<div class="card"> |
|||
<div class="card-body" style="min-height: 496px"> |
|||
<h3 class="mb-4">Upcoming Events</h3> |
|||
@await Component.InvokeAsync(typeof(EventsAreaViewComponent), new |
|||
{ |
|||
minDate = Clock.Now.ClearTime(), |
|||
registeredUserId = Model.User.Id, |
|||
maxResultCount = 6, |
|||
skipCount = 0, |
|||
}) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,54 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Members; |
|||
using EventHub.Organizations; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace EventHub.Web.Pages.Members |
|||
{ |
|||
public class ProfileModel : EventHubPageModel |
|||
{ |
|||
private readonly IMemberAppService _memberAppService; |
|||
private readonly IOrganizationAppService _organizationAppService; |
|||
|
|||
public List<OrganizationInListDto> Organizations { get; set; } |
|||
|
|||
public ProfileModel( |
|||
IMemberAppService memberAppService, |
|||
IOrganizationAppService organizationAppService) |
|||
{ |
|||
_memberAppService = memberAppService; |
|||
_organizationAppService = organizationAppService; |
|||
} |
|||
|
|||
public UserDto User { get; set; } |
|||
|
|||
public async Task<IActionResult> OnGetAsync(string userName) |
|||
{ |
|||
Organizations = (await _organizationAppService.GetMyOrganizationsAsync()).Items.ToList(); |
|||
|
|||
if (userName.IsNullOrWhiteSpace()) |
|||
{ |
|||
if (CurrentUser.IsAuthenticated) |
|||
{ |
|||
userName = CurrentUser.UserName; |
|||
} |
|||
else |
|||
{ |
|||
return Redirect("/events"); |
|||
} |
|||
} |
|||
|
|||
User = await _memberAppService.FindByUserNameAsync(userName); |
|||
|
|||
if (User != null) |
|||
{ |
|||
return Page(); |
|||
} |
|||
|
|||
return Redirect("/events"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,82 +0,0 @@ |
|||
@page "/profile" |
|||
@using EventHub.Web.Pages.Events.Components.EventsArea |
|||
@using EventHub.Web.Pages.Organizations.Components.OrganizationsArea |
|||
@using Volo.Abp.Timing |
|||
@using Volo.Abp.Users |
|||
@inject ICurrentUser CurrentUser |
|||
@inject IClock Clock |
|||
@model EventHub.Web.Pages.ProfileModel |
|||
|
|||
<div class="container pt-4"> |
|||
<div class="row py-4"> |
|||
<div class="col-md"> |
|||
<ul class="nav nav-tabs profile-nav" id="profileTab"> |
|||
<li class="nav-item"> |
|||
<a href="#MyOrganizations" class="nav-link active" data-toggle="tab">My Organizations</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a href="#MyPastEvents" class="nav-link" data-toggle="tab">My Past Events</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a href="#MyUpcomingEvents" class="nav-link" data-toggle="tab">My Upcoming Events</a> |
|||
</li> |
|||
</ul> |
|||
<div class="tab-content profile-content py-4"> |
|||
<div id="MyOrganizations" class="tab-pane fade show active"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<div class="card"> |
|||
<div class="card-body" style="min-height: 496px"> |
|||
<h3 class="mb-4">My Organizations</h3> |
|||
@await Component.InvokeAsync(typeof(OrganizationsAreaViewComponent), new |
|||
{ |
|||
registeredUserId = CurrentUser.GetId(), |
|||
maxResultCount = 12 |
|||
}) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div id="MyPastEvents" class="tab-pane fade"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<div class="card"> |
|||
<div class="card-body" style="min-height: 496px"> |
|||
<h3 class="mb-4">My Past Events</h3> |
|||
<div class="past-events"> |
|||
@await Component.InvokeAsync(typeof(EventsAreaViewComponent), new |
|||
{ |
|||
maxDate = Clock.Now.ClearTime(), |
|||
registeredUserId = CurrentUser.GetId(), |
|||
maxResultCount = 6, |
|||
skipCount = 0 |
|||
}) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div id="MyUpcomingEvents" class="tab-pane fade"> |
|||
<div class="row"> |
|||
<div class="col"> |
|||
<div class="card"> |
|||
<div class="card-body" style="min-height: 496px"> |
|||
<h3 class="mb-4">My Upcoming Events</h3> |
|||
@await Component.InvokeAsync(typeof(EventsAreaViewComponent), new |
|||
{ |
|||
minDate = Clock.Now.ClearTime(), |
|||
registeredUserId = CurrentUser.GetId(), |
|||
maxResultCount = 6, |
|||
skipCount = 0 |
|||
}) |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@ -1,10 +0,0 @@ |
|||
namespace EventHub.Web.Pages |
|||
{ |
|||
public class ProfileModel : EventHubPageModel |
|||
{ |
|||
public void OnGet() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue