From 4bb63859d2c4046c75385989540f18d88a82f130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Stawujak?= Date: Mon, 3 Dec 2018 22:10:32 +0100 Subject: [PATCH] SKE-39 getAllCompetitionCategories - method on server --- .../CompetitionCategoryAppService.cs | 29 +++++++++++++++++++ .../Dto/CompetitionCategoryDto.cs | 9 ++++++ .../Dto/CompetitionCategoryMapProfile.cs | 12 ++++++++ 3 files changed, 50 insertions(+) create mode 100644 SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/CompetitionCategoryAppService.cs create mode 100644 SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryDto.cs create mode 100644 SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryMapProfile.cs diff --git a/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/CompetitionCategoryAppService.cs b/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/CompetitionCategoryAppService.cs new file mode 100644 index 0000000..ba5a141 --- /dev/null +++ b/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/CompetitionCategoryAppService.cs @@ -0,0 +1,29 @@ +using Abp.Authorization; +using Abp.Domain.Repositories; +using System.Collections.Generic; +using System.Linq; +using SystemKonkursow.Competition.CompetitionCategory.Dto; + +namespace SystemKonkursow.Competition.CompetitionCategory +{ + public class CompetitionCategoryAppService : SystemKonkursowAppServiceBase + { + private readonly IRepository _competitionCategoryRepository; + + public CompetitionCategoryAppService(IRepository competitionCategoryRepository) + { + _competitionCategoryRepository = competitionCategoryRepository; + } + + [AbpAuthorize] + public List GetAllCompetitionCategories() + { + var competitionCategories = _competitionCategoryRepository.GetAll().ToList(); + + var mappedObjects = ObjectMapper.Map>(competitionCategories + .OrderBy(t => t.Name)); + + return mappedObjects; + } + } +} diff --git a/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryDto.cs b/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryDto.cs new file mode 100644 index 0000000..48dd8fa --- /dev/null +++ b/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryDto.cs @@ -0,0 +1,9 @@ +using Abp.Application.Services.Dto; + +namespace SystemKonkursow.Competition.CompetitionCategory.Dto +{ + public class CompetitionCategoryDto : EntityDto + { + public string Name { get; set; } + } +} diff --git a/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryMapProfile.cs b/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryMapProfile.cs new file mode 100644 index 0000000..1604ae5 --- /dev/null +++ b/SystemKonkursow/4.2.1/aspnet-core/src/SystemKonkursow.Application/Competition/CompetitionCategory/Dto/CompetitionCategoryMapProfile.cs @@ -0,0 +1,12 @@ +using AutoMapper; + +namespace SystemKonkursow.Competition.CompetitionCategory.Dto +{ + public class CompetitionCategoryMapProfile : Profile + { + public CompetitionCategoryMapProfile() + { + CreateMap(); + } + } +}