SES-153 Add endpoint to create new Shopkeeper with items
This commit is contained in:
parent
99f177887f
commit
42c786b1d0
@ -5,6 +5,7 @@ using SessionCompanion.ViewModels.ApiResponses;
|
||||
using SessionCompanion.ViewModels.ShopkeeperViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -29,5 +30,13 @@ namespace SessionCompanion.Controllers
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user