コード例 #1
0
        public void Create(CourtsViewModel db)
        {
            var entity = new Courts_Table();

            entity.CourtsName = db.CourtsName;
            entities.Courts_Table.Add(entity);
            entities.SaveChanges();

            db.CourtsID = entity.CourtsID;
        }
コード例 #2
0
        public void Destroy(CourtsViewModel db)
        {
            var entity = new Courts_Table();

            entity.CourtsID = db.CourtsID;

            entities.Courts_Table.Attach(entity);

            entities.Courts_Table.Remove(entity);

            entities.SaveChanges();
        }
コード例 #3
0
        public void Update(CourtsViewModel db)
        {
            var entity = new Courts_Table();

            entity.CourtsID   = db.CourtsID;
            entity.CourtsName = db.CourtsName;



            entities.Courts_Table.Attach(entity);
            entities.Entry(entity).State = EntityState.Modified;
            entities.SaveChanges();
        }