コード例 #1
0
        internal void SyncHersteller(Hersteller item)
        {
            HerstellerEntity ent = new HerstellerEntity()
            {
                HerstellerId = item.HerstellerId,
                Name         = item.Name
            };

            switch (item.SyncOperation)
            {
            case "INSERT":
            {
                dataHandler.InsertHersteller(ent);
            }
            break;

            case "UPDATE":
            {
                dataHandler.UpdateHersteller(ent);
            }
            break;

            case "DELETE":
            {
                dataHandler.DeleteHersteller(ent);
            }
            break;
            }
        }
コード例 #2
0
        public void DeleteHersteller(HerstellerEntity herstellerEntity)
        {
            hersteller result = (from x in db.hersteller
                                 where x.hersteller_id == herstellerEntity.HerstellerId
                                 select x).SingleOrDefault();

            db.hersteller.Remove(result);
            db.SaveChanges();
        }
コード例 #3
0
        public void UpdateHersteller(HerstellerEntity herstellerEntity)
        {
            hersteller result = (from x in db.hersteller
                                 where x.hersteller_id == herstellerEntity.HerstellerId
                                 select x).SingleOrDefault();

            result.hersteller_id = Convert.ToInt32(herstellerEntity.HerstellerId);
            result.name          = herstellerEntity.Name;
            db.SaveChanges();
        }
コード例 #4
0
        public void InsertHersteller(HerstellerEntity herstellerEntity)
        {
            hersteller h = new hersteller()
            {
                hersteller_id = Convert.ToInt32(herstellerEntity.HerstellerId),
                name          = herstellerEntity.Name
            };

            db.hersteller.Add(h);
            db.SaveChanges();
        }