Exemplo n.º 1
0
        public async Task <OperationResult> CreateAsync(Restaurant item)
        {
            try
            {
                await _dao.CreateAsync(item);

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

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