From b0aaea1474b501ed90bcee2686157e46a5b7e5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C3=B3reczny?= Date: Thu, 21 Jan 2021 18:29:41 +0100 Subject: [PATCH] controller update --- .../SessionCompanion/Controllers/ShopkeeperController.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SessionCompanion/SessionCompanion/Controllers/ShopkeeperController.cs b/SessionCompanion/SessionCompanion/Controllers/ShopkeeperController.cs index af1bdd3..c58a98f 100644 --- a/SessionCompanion/SessionCompanion/Controllers/ShopkeeperController.cs +++ b/SessionCompanion/SessionCompanion/Controllers/ShopkeeperController.cs @@ -21,6 +21,7 @@ namespace SessionCompanion.Controllers { _service = shopkeeperService; } + /// /// Endpoint zwracajÄ…cy liste sklepikarzy /// @@ -42,5 +43,13 @@ namespace SessionCompanion.Controllers { return await _service.ChangeShopkeeperStatus(shopkeeperId, availability); } + + [HttpPost("createNewShopkeeper")] + public async Task> CreateNewShopKeeper([Required] ShopkeeperWithItemsViewModel shopkeeperWithItemsViewModel) + { + if (!ModelState.IsValid) + return new ErrorResponse() { StatusCode = 500, Message = "Model is invalid" }; + return await _service.CreateNewShopKeeper(shopkeeperWithItemsViewModel); + } } }