Website Summary Files Commits Branches @commit @diff @stats
path: root / src / DevHive.Web / Controllers / TechnologyController.cs
diff options
context:
space:
mode:
Commit83f63ad729d585d597bdcf0afc05b7d56344223e (patch)
Author
 transtrike <transtrike@gmail.com>
2021-01-17 13:38:24 +0200
Committer
 transtrike <transtrike@gmail.com>
2021-01-17 13:38:24 +0200
Filesede845ad2790fe6f6f975f3cc5d776782adecf59 /src/DevHive.Web/Controllers/TechnologyController.cs
DevHive-83f63ad729d585d597bdcf0afc05b7d56344223e.tar
DevHive-83f63ad729d585d597bdcf0afc05b7d56344223e.tar.gz
DevHive-83f63ad729d585d597bdcf0afc05b7d56344223e.zip
Parentb4454f83c3b7d668fc8b18714a659b91576882be (diff)
Lang&Tech layers now return id on Create
1 files changed, 6 insertions, 7 deletions
-rw-r--r--src/DevHive.Web/Controllers/TechnologyController.cs13
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]