public async Task <OperationResult> DeleteAsync(Restaurant restaurant)
        {
            try
            {
                await _dao.DeleteAsync(restaurant);

                return(new OperationResult()
                {
                    Success = true
                });
            }
            catch (Exception e)
            {
                return(new OperationResult()
                {
                    Success = true, Exception = e
                });
            }
        }
示例#2
0
        public async Task <OperationResult> DeleteAsync(Guid id)
        {
            try
            {
                await _dao.DeleteAsync(id);

                return(new OperationResult()
                {
                    Success = true
                });
            }
            catch (Exception e)
            {
                return(new OperationResult()
                {
                    Success = false, Exception = e
                });
            }
        }
示例#3
0
        public async virtual Task <OperationResult> DeleteAsync(Restaurant restaurant)
        {
            try
            {
                using var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions, TransactionScopeAsyncFlowOption.Enabled);
                await _dao.DeleteAsync(restaurant);

                transactionScope.Complete();
                return(new OperationResult {
                    Success = true
                });
            }
            catch (Exception e)
            {
                return(new OperationResult()
                {
                    Success = false, Exception = e
                });
            }
        }