Exemplo n.º 1
0
        public async Task <object> GetInkChemicalByGlueID(int id)
        {
            var list = new List <InkChemicalDto>();
            var data = await _repoPartInkChemical.FindAll().Where(x => x.GlueID == id).ToListAsync();

            foreach (var item in data)
            {
                if (item.InkID != 0)
                {
                    var inkmodel = await _repoInk.FindAll().Where(x => x.ID == item.InkID).Select(x => new InkChemicalDto
                    {
                        ID         = x.ID,
                        Name       = x.Name,
                        Subname    = "Ink",
                        modify     = true,
                        Code       = x.Code,
                        percentage = _repoPartInkChemical.FindAll().FirstOrDefault(x => x.InkID == item.InkID && x.GlueID == id).Percentage
                    }).ToListAsync();

                    foreach (var item2 in inkmodel)
                    {
                        list.Add(item2);
                    }
                }
                else
                {
                    var chemicalmodel = await _repoChemical.FindAll().Where(x => x.ID == item.ChemicalID).Select(x => new InkChemicalDto
                    {
                        ID         = x.ID,
                        Name       = x.Name,
                        Code       = x.Code,
                        Subname    = "Chemical",
                        modify     = x.Modify,
                        percentage = _repoPartInkChemical.FindAll().FirstOrDefault(x => x.ChemicalID == item.ChemicalID && x.GlueID == id).Percentage
                    }).ToListAsync();

                    foreach (var item2 in chemicalmodel)
                    {
                        list.Add(item2);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 2
0
 private async Task <bool> CheckExistInk(ChemicalForImportExcelDto ink)
 {
     return(await _repoChemical.FindAll().AnyAsync(x => x.Name == ink.Name && x.ProcessID == ink.ProcessID));
 }