From 56f5578d5f93a56984deb6735dba51551868f6d8 Mon Sep 17 00:00:00 2001 From: transtrike Date: Tue, 12 Jan 2021 20:45:14 +0200 Subject: Full implementation of Language & Technologies to User --- src/DevHive.Services/Services/TechnologyService.cs | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/DevHive.Services/Services/TechnologyService.cs') diff --git a/src/DevHive.Services/Services/TechnologyService.cs b/src/DevHive.Services/Services/TechnologyService.cs index 2913a55..883b8c5 100644 --- a/src/DevHive.Services/Services/TechnologyService.cs +++ b/src/DevHive.Services/Services/TechnologyService.cs @@ -17,8 +17,10 @@ namespace DevHive.Services.Services this._technologyRepository = technologyRepository; this._technologyMapper = technologyMapper; } - - public async Task Create(TechnologyServiceModel technologyServiceModel) + + #region Create + + public async Task Create(CreateTechnologyServiceModel technologyServiceModel) { if (await this._technologyRepository.DoesTechnologyNameExist(technologyServiceModel.Name)) throw new ArgumentException("Technology already exists!"); @@ -28,7 +30,10 @@ namespace DevHive.Services.Services return result; } - + #endregion + + #region Read + public async Task GetTechnologyById(Guid id) { Technology technology = await this._technologyRepository.GetByIdAsync(id); @@ -38,10 +43,13 @@ namespace DevHive.Services.Services return this._technologyMapper.Map(technology); } + #endregion + + #region Update public async Task UpdateTechnology(UpdateTechnologyServiceModel updateTechnologyServiceModel) { - if (!await this._technologyRepository.DoesTechnologyExist(updateTechnologyServiceModel.Id)) + if (!await this._technologyRepository.DoesTechnologyExistAsync(updateTechnologyServiceModel.Id)) throw new ArgumentException("Technology does not exist!"); if (await this._technologyRepository.DoesTechnologyNameExist(updateTechnologyServiceModel.Name)) @@ -52,10 +60,13 @@ namespace DevHive.Services.Services return result; } - + #endregion + + #region Delete + public async Task DeleteTechnology(Guid id) { - if (!await this._technologyRepository.DoesTechnologyExist(id)) + if (!await this._technologyRepository.DoesTechnologyExistAsync(id)) throw new ArgumentException("Technology does not exist!"); Technology technology = await this._technologyRepository.GetByIdAsync(id); @@ -63,5 +74,6 @@ namespace DevHive.Services.Services return result; } + #endregion } } \ No newline at end of file -- cgit v1.2.3