SES-153 Endpoint tworzący sklepikarza #81

Merged
s426134 merged 4 commits from SES-153 into dev 2021-01-21 17:36:34 +01:00
Showing only changes of commit 42c786b1d0 - Show all commits

View File

@ -5,6 +5,7 @@ using SessionCompanion.ViewModels.ApiResponses;
using SessionCompanion.ViewModels.ShopkeeperViewModels; using SessionCompanion.ViewModels.ShopkeeperViewModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -29,5 +30,13 @@ namespace SessionCompanion.Controllers
{ {
return _service.Get().ToList(); return _service.Get().ToList();
} }
[HttpPost("createNewShopkeeper")]
public async Task<Either<SuccessResponse, ErrorResponse>> CreateNewShopKeeper([Required] ShopkeeperWithItemsViewModel shopkeeperWithItemsViewModel)
{
if (!ModelState.IsValid)
return new ErrorResponse() { StatusCode = 500, Message = "Model is invalid" };
return await _service.CreateNewShopKeeper(shopkeeperWithItemsViewModel);
}
} }
} }