protected override Task <RequestStatus> HandleCommand(RemoveImageCommand request, CancellationToken cancellationToken) { var auctionCreateSession = _auctionCreateSessionService.GetExistingSession(); auctionCreateSession.AddOrReplaceImage(null, request.ImgNum); _auctionCreateSessionService.SaveSession(auctionCreateSession); _logger.LogDebug("Removed image {num} from auctionCreateSession user: {@user}", request.ImgNum, auctionCreateSession.Creator); var response = RequestStatus.CreateFromCommandContext(request.CommandContext, Status.COMPLETED); return(Task.FromResult(response)); }
protected override Task <RequestStatus> HandleCommand(StartAuctionCreateSessionCommand request, CancellationToken cancellationToken) { Common.Domain.AuctionCreateSession.AuctionCreateSession session; if (_auctionCreateSessionService.SessionExists()) { _logger.LogDebug("Starting new AuctionCreateSession"); session = _auctionCreateSessionService.GetExistingSession(); session.ResetSession(); _auctionCreateSessionService.SaveSession(session); } else { session = _auctionCreateSessionService.StartAndSaveNewSession(); } return(Task.FromResult(RequestStatus.CreateFromCommandContext(request.CommandContext, Status.COMPLETED))); }