Esempio n. 1
0
        public async Task Create(Company company, DateTime tsStamp, string usStamp, string asStamp)
        {
            company.SetBaseData(tsStamp, usStamp, asStamp);
            _context.Entry(company).State = EntityState.Added;

            await _context.SaveChangesAsync();

            CompanyChildLogic companyChildLogic = new CompanyChildLogic(_context);
            await companyChildLogic.Create(company.CompanyParentChilds, tsStamp, usStamp, asStamp);

            await companyChildLogic.Create(company.CompanyChildChilds, tsStamp, usStamp, asStamp);
        }
Esempio n. 2
0
        public async Task Update(Company company, DateTime tsStamp, string usStamp, string asStamp)
        {
            company.SetBaseData(tsStamp, usStamp, asStamp);
            _context.Entry(company).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                CompanyChildLogic companyChildLogic = new CompanyChildLogic(_context);
                await companyChildLogic.Update(company.CompanyParentChilds, tsStamp, usStamp, asStamp);

                await companyChildLogic.Update(company.CompanyChildChilds, tsStamp, usStamp, asStamp);
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
        }