Esempio n. 1
0
        private async Task <InkDto> AddInk(InkForImportExcelDto inkDto)
        {
            var result = new InkDto();

            using (var scope = new TransactionScope(TransactionScopeOption.Required,
                                                    new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }, TransactionScopeAsyncFlowOption.Enabled))
            {
                var supname = await _repoSup.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(inkDto.Supplier.ToUpper()));

                if (supname != null)
                {
                    result.SupplierID = supname.ID;
                }
                else
                {
                }

                var process = await _repoProcess.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(inkDto.Process.ToUpper()));

                if (process != null)
                {
                    result.ProcessID = process.ID;
                }
                else
                {
                }

                // result.CreatedBy = inkDto.CreatedBy;
                scope.Complete();
                return(result);
            }
        }
Esempio n. 2
0
 private async Task <bool> CheckExistInk(InkForImportExcelDto ink)
 {
     return(await _repoInk.FindAll().AnyAsync(x => x.Name == ink.Name && x.ProcessID == ink.ProcessID));
 }