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

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

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