|
|
@ -2,6 +2,7 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.ComponentModel; |
|
|
using System.ComponentModel; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
|
|
using System.Globalization; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using EventHub.Events; |
|
|
using EventHub.Events; |
|
|
@ -9,6 +10,7 @@ using EventHub.Organizations; |
|
|
using JetBrains.Annotations; |
|
|
using JetBrains.Annotations; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc.Rendering; |
|
|
using Microsoft.AspNetCore.Mvc.Rendering; |
|
|
|
|
|
using NUglify.Helpers; |
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
|
|
|
|
|
|
|
|
namespace EventHub.Web.Pages.Events |
|
|
namespace EventHub.Web.Pages.Events |
|
|
@ -20,6 +22,7 @@ namespace EventHub.Web.Pages.Events |
|
|
|
|
|
|
|
|
public List<SelectListItem> Organizations { get; private set; } |
|
|
public List<SelectListItem> Organizations { get; private set; } |
|
|
public List<SelectListItem> Countries { get; private set; } |
|
|
public List<SelectListItem> Countries { get; private set; } |
|
|
|
|
|
public List<SelectListItem> Languages { get; private set; } |
|
|
|
|
|
|
|
|
private readonly IEventAppService _eventAppService; |
|
|
private readonly IEventAppService _eventAppService; |
|
|
private readonly IOrganizationAppService _organizationAppService; |
|
|
private readonly IOrganizationAppService _organizationAppService; |
|
|
@ -42,6 +45,7 @@ namespace EventHub.Web.Pages.Events |
|
|
|
|
|
|
|
|
await FillOrganizationsAsync(); |
|
|
await FillOrganizationsAsync(); |
|
|
await FillCountriesAsync(); |
|
|
await FillCountriesAsync(); |
|
|
|
|
|
FillLanguages(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task FillOrganizationsAsync() |
|
|
private async Task FillOrganizationsAsync() |
|
|
@ -69,6 +73,22 @@ namespace EventHub.Web.Pages.Events |
|
|
).ToList(); |
|
|
).ToList(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void FillLanguages() |
|
|
|
|
|
{ |
|
|
|
|
|
var result = CultureInfo.GetCultures(CultureTypes.NeutralCultures) |
|
|
|
|
|
.DistinctBy(x => x.EnglishName) |
|
|
|
|
|
.OrderBy(x => x.EnglishName) |
|
|
|
|
|
.ToList(); |
|
|
|
|
|
result.Remove(result.Single(x => x.TwoLetterISOLanguageName == "iv")); // Invariant Language
|
|
|
|
|
|
|
|
|
|
|
|
Languages = result.Select( |
|
|
|
|
|
cultureInfo => new SelectListItem |
|
|
|
|
|
{ |
|
|
|
|
|
Value = cultureInfo.TwoLetterISOLanguageName, |
|
|
|
|
|
Text = cultureInfo.EnglishName |
|
|
|
|
|
} |
|
|
|
|
|
).ToList(); |
|
|
|
|
|
} |
|
|
public async Task<IActionResult> OnPostAsync() |
|
|
public async Task<IActionResult> OnPostAsync() |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
@ -85,6 +105,7 @@ namespace EventHub.Web.Pages.Events |
|
|
ShowAlert(exception); |
|
|
ShowAlert(exception); |
|
|
await FillOrganizationsAsync(); |
|
|
await FillOrganizationsAsync(); |
|
|
await FillCountriesAsync(); |
|
|
await FillCountriesAsync(); |
|
|
|
|
|
FillLanguages(); |
|
|
return Page(); |
|
|
return Page(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -119,11 +140,16 @@ namespace EventHub.Web.Pages.Events |
|
|
[SelectItems(nameof(Countries))] |
|
|
[SelectItems(nameof(Countries))] |
|
|
[DisplayName("Country")] |
|
|
[DisplayName("Country")] |
|
|
public Guid? CountryId { get; set; } |
|
|
public Guid? CountryId { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[SelectItems(nameof(Languages))] |
|
|
|
|
|
[DisplayName("Language")] |
|
|
|
|
|
public string Language { get; set; } |
|
|
|
|
|
|
|
|
[CanBeNull] |
|
|
[CanBeNull] |
|
|
[StringLength(EventConsts.MaxCityLength, MinimumLength = EventConsts.MinCityLength)] |
|
|
[StringLength(EventConsts.MaxCityLength, MinimumLength = EventConsts.MinCityLength)] |
|
|
public string City { get; set; } |
|
|
public string City { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[Range(1, int.MaxValue)] |
|
|
public int? Capacity { get; set; } |
|
|
public int? Capacity { get; set; } |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|