diff --git a/src/EventHub.Web/Pages/Events/Components/ListArea/Default.cshtml b/src/EventHub.Web/Pages/Events/Components/ListArea/Default.cshtml new file mode 100644 index 0000000..c5f0037 --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/ListArea/Default.cshtml @@ -0,0 +1,45 @@ +@using System.Globalization +@using EventHub.Web.Pages.Events +@model EventHub.Web.Pages.Events.Components.ListArea.ListAreaViewComponent.ListAreaViewComponentModel + +@if (Model.Events != null && Model.Events.Count > 0) +{ +
+ + @foreach (var eventDto in Model.Events) + { +
+
+ @if (eventDto.CoverImageContent is null) + { + @eventDto.Title + } + else + { + @eventDto.Title + } +
+
+
+
+
+ @eventDto.StartTime.ToString("MMM") + @eventDto.StartTime.Day +
+
+
+
+
@eventDto.Title
+ @eventDto.StartTime.ToString("hh tt", CultureInfo.InvariantCulture) - @eventDto.EndTime.ToString("hh tt", CultureInfo.InvariantCulture) | @EventDateHelper.GetLocationInfo(@eventDto) +

@eventDto.Description

+
+ Learn More +
+
+
+
+
+
+ } +
+} \ No newline at end of file diff --git a/src/EventHub.Web/Pages/Events/Components/ListArea/ListAreaViewComponent.cs b/src/EventHub.Web/Pages/Events/Components/ListArea/ListAreaViewComponent.cs new file mode 100644 index 0000000..170caee --- /dev/null +++ b/src/EventHub.Web/Pages/Events/Components/ListArea/ListAreaViewComponent.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using EventHub.Events; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace EventHub.Web.Pages.Events.Components.ListArea +{ + [Widget(AutoInitialize = true)] + public class ListAreaViewComponent : AbpViewComponent + { + private readonly IEventAppService _eventAppService; + + public ListAreaViewComponent(IEventAppService eventAppService) + { + _eventAppService = eventAppService; + } + + public async Task InvokeAsync( + Guid? organizationId, + DateTime? minDate, + DateTime? maxDate, + bool? isOnline, + int? skipCount, + int maxResultCount = 15) + { + var result = await _eventAppService.GetListAsync( + new EventListFilterDto + { + OrganizationId = organizationId, + MinDate = minDate, + MaxDate = maxDate, + IsOnline = isOnline, + SkipCount = skipCount.GetValueOrDefault(), + MaxResultCount = maxResultCount + } + ); + + return View( + "~/Pages/Events/Components/ListArea/Default.cshtml", + new ListAreaViewComponentModel + { + Events = result.Items, + TotalCount = result.TotalCount + } + ); + } + + public class ListAreaViewComponentModel + { + public IReadOnlyList Events { get; set; } + + public long TotalCount { get; set; } + } + } +} \ No newline at end of file