public async Task <ValidationResult> Handle(RemoveTodoAppCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { return(message.ValidationResult); } var todoApp = await _todoAppRepository.GetById(message.Id); if (todoApp is null) { AddError("The todoApp doesn't exists."); return(ValidationResult); } _todoAppRepository.Remove(todoApp); return(await Commit(_todoAppRepository.UnitOfWork)); }
public async Task <TodoAppViewModel> GetById(Guid id) { return(_mapper.Map <TodoAppViewModel>(await _todoAppRepository.GetById(id))); }