Browse Source

Minor refactors.

pull/29/head
Halil İbrahim Kalkan 6 years ago
parent
commit
51424a0481
  1. 10
      src/EventHub.Application/Events/EventAppService.cs
  2. 4
      src/EventHub.Domain.Shared/Localization/EventHub/en.json
  3. 1
      src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs

10
src/EventHub.Application/Events/EventAppService.cs

@ -54,8 +54,10 @@ namespace EventHub.Events
if (organization.OwnerUserId != CurrentUser.GetId()) if (organization.OwnerUserId != CurrentUser.GetId())
{ {
throw new BusinessException(EventHubErrorCodes.NotAuthorizedToCreateEventInThisOrganization) throw new AbpAuthorizationException(
.WithData("OrganizationName", organization.DisplayName); L["EventHub:NotAuthorizedToCreateEventInThisOrganization", organization.DisplayName],
EventHubErrorCodes.NotAuthorizedToCreateEventInThisOrganization
);
} }
var @event = await _eventManager.CreateAsync( var @event = await _eventManager.CreateAsync(
@ -184,7 +186,7 @@ namespace EventHub.Events
var countriesQueryable = await _countriesRepository.GetQueryableAsync(); var countriesQueryable = await _countriesRepository.GetQueryableAsync();
var query = from country in countriesQueryable var query = from country in countriesQueryable
orderby country.Name ascending orderby country.Name
select country; select country;
var countries = await AsyncExecuter.ToListAsync(query); var countries = await AsyncExecuter.ToListAsync(query);
@ -209,7 +211,7 @@ namespace EventHub.Events
if (organization.OwnerUserId != CurrentUser.GetId()) if (organization.OwnerUserId != CurrentUser.GetId())
{ {
throw new AbpAuthorizationException( throw new AbpAuthorizationException(
L["EventHub:NotAuthorizedToUpdateEvent"].Value.Replace("{EventTitle}", @event.Title), L["EventHub:NotAuthorizedToUpdateEvent", @event.Title],
EventHubErrorCodes.NotAuthorizedToUpdateEvent EventHubErrorCodes.NotAuthorizedToUpdateEvent
); );
} }

4
src/EventHub.Domain.Shared/Localization/EventHub/en.json

@ -17,7 +17,7 @@
"DisplayName:IsOnline": "Is Online?", "DisplayName:IsOnline": "Is Online?",
"DisplayName:Capacity": "Capacity", "DisplayName:Capacity": "Capacity",
"EventHub:OrganizationNameAlreadyExists": "The organization {Name} already exists. Please use another name.", "EventHub:OrganizationNameAlreadyExists": "The organization {Name} already exists. Please use another name.",
"EventHub:NotAuthorizedToCreateEventInThisOrganization": "You are not authorized to create events for the organization {OrganizationName}.", "EventHub:NotAuthorizedToCreateEventInThisOrganization": "You are not authorized to create events for the organization {0}.",
"EventHub:EventEndTimeCantBeEarlierThanStartTime": "Event end time can not be earlier than the start time.", "EventHub:EventEndTimeCantBeEarlierThanStartTime": "Event end time can not be earlier than the start time.",
"EventHub:CantRegisterOrUnregisterForAPastEvent": "Can not register to or unregister from an event in the past.", "EventHub:CantRegisterOrUnregisterForAPastEvent": "Can not register to or unregister from an event in the past.",
"Events": "Events", "Events": "Events",
@ -63,7 +63,7 @@
"LocationHasNotSpecifiedYet": "Event {0} has not been specified yet.", "LocationHasNotSpecifiedYet": "Event {0} has not been specified yet.",
"Language": "Language", "Language": "Language",
"EventHub:CapacityCantBeLowerThanRegisteredUserCount": "Capacity can not be lower than the currently registered user count.", "EventHub:CapacityCantBeLowerThanRegisteredUserCount": "Capacity can not be lower than the currently registered user count.",
"EventHub:NotAuthorizedToUpdateEvent": "You are not authorized to update the \"{EventTitle}\" event.", "EventHub:NotAuthorizedToUpdateEvent": "You are not authorized to update the \"{0}\" event.",
"CoverImage": "Cover Image", "CoverImage": "Cover Image",
"EventHub:CantChangeEventTiming": "Can not change the event timing more than {MaxTimingChangeLimit} times.", "EventHub:CantChangeEventTiming": "Can not change the event timing more than {MaxTimingChangeLimit} times.",
"EventCoverImageEditSuccessMessage": "The event's cover image has been changed successfully.", "EventCoverImageEditSuccessMessage": "The event's cover image has been changed successfully.",

1
src/EventHub.Domain/Events/Registrations/EventRegistrationManager.cs

@ -4,7 +4,6 @@ using EventHub.Users;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
using Volo.Abp.Timing;
namespace EventHub.Events.Registrations namespace EventHub.Events.Registrations
{ {

Loading…
Cancel
Save