Exemple #1
0
        public async Task <IHttpActionResult> Delete(Guid id)
        {
            var command = new DeletePromoterCommand
            {
                Id = id
            };
            var response = await Bus.Send <DeletePromoterCommand, PromoterCommandResponse>(command);

            return(Ok(response));
        }
Exemple #2
0
        public async Task <PromoterCommandResponse> Handle(DeletePromoterCommand command)
        {
            var promoter = await _repository.FindAsync(command.Id);

            if (promoter == null)
            {
                throw new DomainException("شخص یافت نشد");
            }
            promoter.CustomerSubsets.Clear();
            _repository.Remove(promoter);
            return(new PromoterCommandResponse());
        }