public async Task ProjectAsync(Firm state)
        {
            var firm = await _dbContext.Firms.SingleOrDefaultAsync(x => x.Code == state.Code);

            if (firm == null)
            {
                await _dbContext.AddAsync(state);
            }
            else
            {
                _dbContext.Entry(firm).CurrentValues.SetValues(state);
            }

            await _dbContext.SaveChangesAsync();
        }
Пример #2
0
        public async Task ProjectAsync(SecondRubric state)
        {
            var secondRubric = await _dbContext.SecondRubrics.Include(x => x.Localizations).SingleOrDefaultAsync(x => x.Code == state.Code);

            if (secondRubric == null)
            {
                await _dbContext.AddAsync(state);
            }
            else
            {
                _dbContext.Entry(secondRubric).CurrentValues.SetValues(state);
            }

            await _dbContext.SaveChangesAsync();
        }
        public async Task ProjectAsync(Category state)
        {
            var category = await _dbContext.Categories.Include(x => x.Localizations).SingleOrDefaultAsync(x => x.Code == state.Code);

            if (category == null)
            {
                await _dbContext.AddAsync(state);
            }
            else
            {
                _dbContext.Entry(category).CurrentValues.SetValues(state);
            }

            await _dbContext.SaveChangesAsync();
        }
Пример #4
0
        public async Task ProjectAsync(CardForERM state)
        {
            var card = await _dbContext.Cards.Include(x => x.Rubrics).SingleOrDefaultAsync(x => x.Code == state.Code);

            if (card == null)
            {
                await _dbContext.AddAsync(state);
            }
            else
            {
                _dbContext.Entry(card).CurrentValues.SetValues(state);
            }

            await _dbContext.SaveChangesAsync();
        }
        public async Task ProjectAsync(Branch state)
        {
            var branch = await _dbContext.Branches
                         .Include(x => x.Localizations)
                         .SingleOrDefaultAsync(x => x.Code == state.Code);

            if (branch == null)
            {
                await _dbContext.AddAsync(state);
            }
            else
            {
                _dbContext.Entry(branch).CurrentValues.SetValues(state);
            }

            await _dbContext.SaveChangesAsync();
        }