public async Task HandleAsync(EditCardCommandModel command) { var path = _imagesManager.GetPhysicalPath(command.Topic, command.Category, command.Deck, command.Id); command.Question = _imagesManager.ProcessTextForEdit(command.Topic, command.Category, command.Deck, command.Id, command.Question); command.Answer = _imagesManager.ProcessTextForEdit(command.Topic, command.Category, command.Deck, command.Id, command.Answer); _imagesManager.RemoveDirectory(path); _imagesManager.SaveImages(command.Topic, command.Category, command.Deck, command.Id); await _cardsCommandService.EditAsync(command.Id, command.Title, command.Question, command.Answer); }
public async Task HandleAsync(AddCardCommandModel command) { if (command.Id.IsEmpty()) { command.Id = Guid.NewGuid(); } command.Question = _imagesManager.ProcessTextForEdit(command.Topic, command.Category, command.Deck, command.Id, command.Question); command.Answer = _imagesManager.ProcessTextForEdit(command.Topic, command.Category, command.Deck, command.Id, command.Answer); _imagesManager.SaveImages(command.Topic, command.Category, command.Deck, command.Id); await _cardsCommandService.AddAsync(command.Deck, command.Title, command.Question, command.Answer); }