Replaced if/else with switch

This commit is contained in:
Kenn Jacobsen
2021-03-01 13:17:24 +01:00
parent 06c5ce5bb8
commit 0bdd1cc874

View File

@@ -55,25 +55,23 @@ namespace Umbraco.Cms.Web.BackOffice.Filters
{
var model = objectContent.Value;
if (model is ContentItemDisplay content)
switch (model)
{
_eventAggregator.Publish(new SendingContentNotification(content, umbracoContext));
}
else if (model is MediaItemDisplay media)
{
_eventAggregator.Publish(new SendingMediaNotification(media, umbracoContext));
}
else if (model is MemberDisplay member)
{
_eventAggregator.Publish(new SendingMemberNotification(member, umbracoContext));
}
else if (model is UserDisplay user)
{
_eventAggregator.Publish(new SendingUserNotification(user, umbracoContext));
}
else if (model is IEnumerable<Tab<IDashboardSlim>> dashboards)
{
_eventAggregator.Publish(new SendingDashboardsNotification(dashboards, umbracoContext));
case ContentItemDisplay content:
_eventAggregator.Publish(new SendingContentNotification(content, umbracoContext));
break;
case MediaItemDisplay media:
_eventAggregator.Publish(new SendingMediaNotification(media, umbracoContext));
break;
case MemberDisplay member:
_eventAggregator.Publish(new SendingMemberNotification(member, umbracoContext));
break;
case UserDisplay user:
_eventAggregator.Publish(new SendingUserNotification(user, umbracoContext));
break;
case IEnumerable<Tab<IDashboardSlim>> dashboards:
_eventAggregator.Publish(new SendingDashboardsNotification(dashboards, umbracoContext));
break;
}
}
}