Example #1
0
        public async Task <bool> DeleteAsync(BudgetViewObject data)
        {
            var presup1 = new PRESUP1()
            {
                NUMERO_PRE = data.NUMERO_PRE
            };
            var presup2 = new PRESUP2()
            {
                NUMERO_PRE = data.NUMERO_PRE
            };
            var resultValue = false;

            using (var deleter = _sqlExecutor.OpenNewDbConnection())
            {
                using (var transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                {
                    resultValue = await DeleteHelper.DeleteAsync <PRESUP1, PRESUP2, PRESUP1>(_sqlExecutor, presup1, presup2);

                    if (resultValue)
                    {
                        transactionScope.Complete();
                    }
                    else
                    {
                        transactionScope.Dispose();
                    }
                }
            }
            return(resultValue);
        }
Example #2
0
        /// <summary>
        ///  Delete asynchronously the booking data
        /// </summary>
        /// <param name="data">Data transfer object to delete</param>
        /// <returns>Data value</returns>
        public async Task <bool> DeleteAsync(BookingViewObject data)
        {
            var book1 = new RESERVAS1()
            {
                NUMERO_RES = data.NUMERO_RES
            };
            var book2 = new RESERVAS2()
            {
                NUMERO_RES = data.NUMERO_RES
            };
            var bookItems   = _mapper.Map <IEnumerable <BookingItemsViewObject>, IEnumerable <LIRESER> >(data.Items);
            var resultValue = await DeleteHelper.DeleteAsync <RESERVAS1, RESERVAS2, LIRESER>(_executor, book1, book2);

            return(resultValue);
        }