public async Task <OperationResult> DeleteAsync(Dish dish)
        {
            try
            {
                await _dao.DeleteAsync(dish);

                return(new OperationResult()
                {
                    Success = true
                });
            }
            catch (Exception e)
            {
                return(new OperationResult()
                {
                    Success = false, Exception = e
                });
            }
        }
Esempio n. 2
0
        public async virtual Task <OperationResult> DeleteAsync(Dish dish)
        {
            try
            {
                using var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions, TransactionScopeAsyncFlowOption.Enabled);
                await _dao.DeleteAsync(dish);

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