public async Task AssignCounterToBranch(AssignCounterToBranchViewModel request, CancellationToken cancellationToken = default)
        {
            var entity = await _context.Counters.FindAsync(request.CounterId);

            if (entity == null)
            {
                throw new NotFoundException(nameof(Counter), request.CounterId);
            }

            var mappedEntity = request.Map(entity);

            _context.Counters.Update(mappedEntity);

            await _context.SaveChangesAsync(cancellationToken);
        }
示例#2
0
        public async Task <ActionResult> AssignCounterToBranch([FromBody] AssignCounterToBranchViewModel request)
        {
            await _branchManagement.AssignCounterToBranch(request);

            return(Ok());
        }