aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers/TechnologyController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Web/Controllers/TechnologyController.cs')
-rw-r--r--src/DevHive.Web/Controllers/TechnologyController.cs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/DevHive.Web/Controllers/TechnologyController.cs b/src/DevHive.Web/Controllers/TechnologyController.cs
index 104b96e..ba2ffdc 100644
--- a/src/DevHive.Web/Controllers/TechnologyController.cs
+++ b/src/DevHive.Web/Controllers/TechnologyController.cs
@@ -22,16 +22,15 @@ namespace DevHive.Web.Controllers
}
[HttpPost]
- public async Task<IActionResult> Create([FromBody] CreateTechnologyWebModel technologyWebModel)
+ public async Task<IActionResult> Create([FromBody] CreateTechnologyWebModel createTechnologyWebModel)
{
- CreateTechnologyServiceModel technologyServiceModel = this._technologyMapper.Map<CreateTechnologyServiceModel>(technologyWebModel);
+ CreateTechnologyServiceModel technologyServiceModel = this._technologyMapper.Map<CreateTechnologyServiceModel>(createTechnologyWebModel);
- bool result = await this._technologyService.Create(technologyServiceModel);
+ Guid id = await this._technologyService.Create(technologyServiceModel);
- if (!result)
- return new BadRequestObjectResult("Could not create the Technology");
-
- return new OkResult();
+ return id == Guid.Empty ?
+ new BadRequestObjectResult($"Could not create technology {createTechnologyWebModel.Name}") :
+ new OkObjectResult(new { Id = id });
}
[HttpGet]