/// <summary> /// Handler which processes the command when /// customer executes cancel order from app /// </summary> /// <param name="command"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task HandleAsync(DeleteOrderCommand command, CancellationToken cancellationToken) { var order = await _orderRepository.GetAsync(command.OrderId); if (order == null) { return; } await _orderRepository.DeleteAsync(order); }
/// <summary> /// Handler which processes the command when /// customer executes cancel order from app /// </summary> /// <param name="command"></param> /// <returns></returns> public async Task <Unit> Handle(DeleteOrderCommand command, CancellationToken cancellationToken) { var order = await _orderRepository.GetAsync(command.OrderId); if (order == null) { return(Unit.Value); } await _orderRepository.DeleteAsync(order); await _unitOfWorkManager.CommitAsync(); return(Unit.Value); }
public async Task <Orders> DeleteOrder(int id) { return(await _orderRpo.DeleteAsync(id)); }