public async Task UpdateCounter(UpdateCounterViewModel 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); }
public async Task <ActionResult> UpdateCounter(UpdateCounterViewModel request) { await _counterManagement.UpdateCounter(request); return(Ok()); }