Esempio n. 1
0
        public void Save(Users user)
        {
            if (user.Id == 0)
            {
                _dbContext.Users.Add(user);
            }
            else
            {
                _dbContext.Entry(user).State = EntityState.Modified;
            }

            _dbContext.SaveChanges();
        }
        public void Save(Additions addition)
        {
            if (addition.Id == 0)
            {
                _dbContext.Additions.Add(addition);
            }
            else
            {
                _dbContext.Entry(addition).State = EntityState.Modified;
            }

            _dbContext.SaveChanges();
        }
Esempio n. 3
0
        public void Save(Services service)
        {
            if (service.Id == 0)
            {
                _dbContext.Services.Add(service);
            }
            else
            {
                _dbContext.Entry(service).State = EntityState.Modified;

                _dbContext.ServiceAdditions.AddRange(service.ServiceAdditions);
            }

            _dbContext.SaveChanges();
        }