示例#1
0
        public async Task <CreateBatchOptionResponse> Post(CreateBatchOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            if (await batchRepository.DoesBatchOptionExist(request.BatchId, request.OptionName))
            {
                throw Err.BatchOptionAlreadyExists(request.OptionName);
            }

            var batchOption = request.ConvertTo <BatchOption>();

            await batchRepository.CreateOrUpdateBatchOption(batchOption);

            return(new CreateBatchOptionResponse());
        }