aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Services/Services/TechnologyService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Services/Services/TechnologyService.cs')
-rw-r--r--src/DevHive.Services/Services/TechnologyService.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/DevHive.Services/Services/TechnologyService.cs b/src/DevHive.Services/Services/TechnologyService.cs
index 2b24ed6..3cc0861 100644
--- a/src/DevHive.Services/Services/TechnologyService.cs
+++ b/src/DevHive.Services/Services/TechnologyService.cs
@@ -35,9 +35,9 @@ namespace DevHive.Services.Services
#region Read
- public async Task<TechnologyServiceModel> GetTechnologyById(Guid id)
+ public async Task<TechnologyServiceModel> GetTechnologyById(Guid technologyId)
{
- Technology technology = await this._technologyRepository.GetByIdAsync(id);
+ Technology technology = await this._technologyRepository.GetByIdAsync(technologyId);
if (technology == null)
throw new ArgumentException("The technology does not exist");
@@ -48,14 +48,15 @@ namespace DevHive.Services.Services
#region Update
- public async Task<bool> UpdateTechnology(UpdateTechnologyServiceModel updateTechnologyServiceModel)
+ public async Task<bool> UpdateTechnology(Guid technologyId, UpdateTechnologyServiceModel updateTechnologyServiceModel)
{
- if (!await this._technologyRepository.DoesTechnologyExistAsync(updateTechnologyServiceModel.Id))
+ if (!await this._technologyRepository.DoesTechnologyExistAsync(technologyId))
throw new ArgumentException("Technology does not exist!");
if (await this._technologyRepository.DoesTechnologyNameExistAsync(updateTechnologyServiceModel.Name))
throw new ArgumentException("Technology name already exists!");
+ updateTechnologyServiceModel.Id = technologyId;
Technology technology = this._technologyMapper.Map<Technology>(updateTechnologyServiceModel);
bool result = await this._technologyRepository.EditAsync(technology);
@@ -65,12 +66,12 @@ namespace DevHive.Services.Services
#region Delete
- public async Task<bool> DeleteTechnology(Guid id)
+ public async Task<bool> DeleteTechnology(Guid technologyId)
{
- if (!await this._technologyRepository.DoesTechnologyExistAsync(id))
+ if (!await this._technologyRepository.DoesTechnologyExistAsync(technologyId))
throw new ArgumentException("Technology does not exist!");
- Technology technology = await this._technologyRepository.GetByIdAsync(id);
+ Technology technology = await this._technologyRepository.GetByIdAsync(technologyId);
bool result = await this._technologyRepository.DeleteAsync(technology);
return result;