Ejemplo 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);
            }
        }
Ejemplo n.º 2
0
        public async Task <bool> Add(InkDto model)
        {
            var ink = _mapper.Map <Ink>(model);

            ink.isShow      = true;
            ink.CreatedDate = DateTime.Now;
            _repoInk.Add(ink);
            return(await _repoInk.SaveAll());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(InkDto entity)
        {
            return(Ok(await _inkService.Add(entity)));
            // if (await _ingredientService.CheckExists(entity.ID))
            //     return BadRequest("Ingredient ID already exists!");
            // if (await _ingredientService.CheckBarCodeExists(entity.Code))
            //     return BadRequest("Ingredient Barcode already exists!");
            // if (await _ingredientService.CheckExistsName(entity.Name))
            //     return BadRequest("Ingredient Name already exists!");
            // entity.CreatedDate = DateTime.Now.ToString("MMMM dd, yyyy HH:mm:ss tt");
            // if (await _ingredientService.Add1(entity))
            // {
            //     return NoContent();
            // }

            // throw new Exception("Creating the brand failed on save");
        }
Ejemplo n.º 4
0
 public Task <bool> Update(InkDto model)
 {
     throw new NotImplementedException();
 }