diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-12 20:45:14 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-12 20:45:14 +0200 |
| commit | 56f5578d5f93a56984deb6735dba51551868f6d8 (patch) | |
| tree | 5f309ba5a79882ad41ed78bf7ae8f18f38be757e /src/DevHive.Services/Services/TechnologyService.cs | |
| parent | d2a754aa220f37ac28393451e7ad5793687bb999 (diff) | |
| download | DevHive-56f5578d5f93a56984deb6735dba51551868f6d8.tar DevHive-56f5578d5f93a56984deb6735dba51551868f6d8.tar.gz DevHive-56f5578d5f93a56984deb6735dba51551868f6d8.zip | |
Full implementation of Language & Technologies to User
Diffstat (limited to 'src/DevHive.Services/Services/TechnologyService.cs')
| -rw-r--r-- | src/DevHive.Services/Services/TechnologyService.cs | 24 |
1 files changed, 18 insertions, 6 deletions
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<bool> Create(TechnologyServiceModel technologyServiceModel) + + #region Create + + public async Task<bool> 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<TechnologyServiceModel> GetTechnologyById(Guid id) { Technology technology = await this._technologyRepository.GetByIdAsync(id); @@ -38,10 +43,13 @@ namespace DevHive.Services.Services return this._technologyMapper.Map<TechnologyServiceModel>(technology); } + #endregion + + #region Update public async Task<bool> 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<bool> 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 |
