Ejemplo n.º 1
0
            public async Task <Result> Handle(EditAdCommand request, CancellationToken cancellationToken)
            {
                var ad = await adRepository.Find(request.Id, cancellationToken);

                ad.UpdateTitle(request.Title)
                .UpdatePrice(request.Price)
                .UpdateDescription(request.Description);

                await adRepository.Save(ad, cancellationToken);

                return(Result.Success);
            }
Ejemplo n.º 2
0
            public async Task <Result> Handle(DeleteAdCommand request, CancellationToken cancellationToken)
            {
                var ad = await adRepository.Find(request.Id, cancellationToken);

                if (ad == null)
                {
                    return(false);
                }

                await adRepository.Delete(ad.Id, cancellationToken);

                return(Result.Success);
            }