public async Task Process(EditResourceCommand command, Unit response, CancellationToken cancellationToken) { var history = HistoryEntry.Create(Guid.NewGuid(), "Resource was updated", _httpContextAccessor.HttpContext.User.Identity.Name, command.Id, DateTimeOffset.UtcNow); await _context.AddAsync(history); }
public async Task Process(BookResourceCommand command, BookResourceResult response, CancellationToken cancellationToken) { var description = response.IsUserInLine ? "User got in line." : $"Resource was booked. Reason: \"{command.BookingReason}\"."; var history = HistoryEntry.Create(Guid.NewGuid(), description, command.BookedBy.Login, command.ResourceId, DateTimeOffset.UtcNow); await _context.AddAsync(history); }
public async Task Process(ReleaseResourceCommand command, ReleaseResourceResult response, CancellationToken cancellationToken) { var userLogin = command.SystemAction ? User.GetSystemUser().Login : response.WhoReleased.Login; var releasedHistory = HistoryEntry.Create(Guid.NewGuid(), "Resource was released.", userLogin, command.ResourceId, DateTimeOffset.UtcNow); await _context.History.AddAsync(releasedHistory); if (response.WhoBooked != null) { var bookedHistory = HistoryEntry.Create(Guid.NewGuid(), $"Resource was booked. Reason: \"{response.BookingReason}\".", response.WhoBooked.Login, command.ResourceId, DateTimeOffset.UtcNow); await _context.History.AddAsync(bookedHistory); } }