public async Task <ItemStoreBranchDto> AddItemAsync(int branchId, ItemStoreBranchDto dto)
        {
            if (dto == null)
            {
                throw new ArgumentNullException();
            }

            _ = await Repository.GetAsync(branchId) ?? throw new BusinessException("Invalid branch id");

            _ = await ItemRepository.GetAsync(dto.ItemID) ?? throw new BusinessException("Invalid item id");

            var entity = await ItemStoreBranchRepository.InsertAsync(new ItemStoreBranchEntity(dto.ItemID, branchId));

            return(ObjectMapper.Map <ItemStoreBranchEntity, ItemStoreBranchDto>(entity));
        }
Exemplo n.º 2
0
 public async Task <ItemStoreBranchDto> AddItem([FromRoute] int id, [FromBody] ItemStoreBranchDto dto)
 {
     return(await StoreBranchAppService.AddItemAsync(id, dto));
 }