diff --git a/eventhub/src/EventHub.Application.Contracts/Organizations/IOrganizationAppService.cs b/eventhub/src/EventHub.Application.Contracts/Organizations/IOrganizationAppService.cs index f3eec8f..ff89aad 100644 --- a/eventhub/src/EventHub.Application.Contracts/Organizations/IOrganizationAppService.cs +++ b/eventhub/src/EventHub.Application.Contracts/Organizations/IOrganizationAppService.cs @@ -9,5 +9,7 @@ namespace EventHub.Organizations Task CreateAsync(CreateOrganizationDto input); Task> GetListAsync(PagedResultRequestDto input); + + Task GetProfileAsync(string name); } } diff --git a/eventhub/src/EventHub.Application.Contracts/Organizations/OrganizationProfileDto.cs b/eventhub/src/EventHub.Application.Contracts/Organizations/OrganizationProfileDto.cs new file mode 100644 index 0000000..d65412a --- /dev/null +++ b/eventhub/src/EventHub.Application.Contracts/Organizations/OrganizationProfileDto.cs @@ -0,0 +1,26 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EventHub.Organizations +{ + public class OrganizationProfileDto : EntityDto + { + public string Name { get; set; } + + public string DisplayName { get; set; } + + public string Description { get; set; } + + public string Website { get; set; } + + public string TwitterUsername { get; set; } + + public string GitHubUsername { get; set; } + + public string FacebookUsername { get; set; } + + public string InstagramUsername { get; set; } + + public string MediumUsername { get; set; } + } +} diff --git a/eventhub/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs b/eventhub/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs index a824477..7cc6fd3 100644 --- a/eventhub/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs +++ b/eventhub/src/EventHub.Application/EventHubApplicationAutoMapperProfile.cs @@ -8,6 +8,7 @@ namespace EventHub public EventHubApplicationAutoMapperProfile() { CreateMap(); + CreateMap(); } } } diff --git a/eventhub/src/EventHub.Application/Organizations/OrganizationAppService.cs b/eventhub/src/EventHub.Application/Organizations/OrganizationAppService.cs index cb20512..4e39672 100644 --- a/eventhub/src/EventHub.Application/Organizations/OrganizationAppService.cs +++ b/eventhub/src/EventHub.Application/Organizations/OrganizationAppService.cs @@ -46,5 +46,11 @@ namespace EventHub.Organizations ObjectMapper.Map, List>(organizations) ); } + + public async Task GetProfileAsync(string name) + { + var organization = await _organizationRepository.GetAsync(o => o.Name == name); + return ObjectMapper.Map(organization); + } } } diff --git a/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json b/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json index 9e89a08..2ce394e 100644 --- a/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json +++ b/eventhub/src/EventHub.Domain.Shared/Localization/EventHub/en.json @@ -10,6 +10,8 @@ "DisplayName:Name": "Name", "DisplayName:DisplayName": "Display Name", "DisplayName:Description": "Description", - "EventHub:OrganizationNameAlreadyExists": "The organization {Name} already exists. Please use another name." + "EventHub:OrganizationNameAlreadyExists": "The organization {Name} already exists. Please use another name.", + "Events": "Events", + "Members": "Members" } } diff --git a/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml b/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml index dd70700..4aadd5d 100644 --- a/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml +++ b/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml @@ -1,3 +1,19 @@ @page "/organizations/{name}" +@inject IHtmlLocalizer L +@using EventHub.Localization +@using Microsoft.AspNetCore.Mvc.Localization @model EventHub.Web.Pages.Organizations.OrganizationProfile -

Organization: @Model.Name

+

@Model.Organization.DisplayName @Model.Organization.Name

+ +

+ @Model.Organization.Description +

+ + + + TODO + + + TODO + + diff --git a/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml.cs b/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml.cs index 4659673..d7e77a0 100644 --- a/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml.cs +++ b/eventhub/src/EventHub.Web/Pages/Organizations/OrganizationProfile.cshtml.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using EventHub.Organizations; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -9,9 +10,18 @@ namespace EventHub.Web.Pages.Organizations [BindProperty(SupportsGet = true)] public string Name { get; set; } - public async Task OnGetAsync() + public OrganizationProfileDto Organization { get; set; } + + private readonly IOrganizationAppService _organizationAppService; + + public OrganizationProfile(IOrganizationAppService organizationAppService) { + _organizationAppService = organizationAppService; + } + public async Task OnGetAsync() + { + Organization = await _organizationAppService.GetProfileAsync(Name); } } } diff --git a/eventhub/test/EventHub.Application.Tests/Organizations/OrganizationAppServiceTests.cs b/eventhub/test/EventHub.Application.Tests/Organizations/OrganizationAppServiceTests.cs index 04820ae..3e2f5f4 100644 --- a/eventhub/test/EventHub.Application.Tests/Organizations/OrganizationAppServiceTests.cs +++ b/eventhub/test/EventHub.Application.Tests/Organizations/OrganizationAppServiceTests.cs @@ -60,5 +60,13 @@ namespace EventHub.Organizations result.Items.ShouldContain(o => o.Name == _testData.OrganizationVolosoftName && o.Id == _testData.OrganizationVolosoftId); result.Items.ShouldContain(o => o.Name == _testData.OrganizationDotnetEuropeName && o.Id == _testData.OrganizationDotnetEuropeId); } + + [Fact] + public async Task Should_Get_An_Organization_Profile() + { + var result = await _organizationAppService.GetProfileAsync(_testData.OrganizationVolosoftName); + result.Id.ShouldBe(_testData.OrganizationVolosoftId); + result.Name.ShouldBe(_testData.OrganizationVolosoftName); + } } }