コード例 #1
0
        //插入Topic表一条新纪录
        public long Insert(long seminarId, Topic topic)
        {
            Seminar s = _db.Seminar.SingleOrDefault(c => c.Id == seminarId);

            topic.Seminar = s;
            try
            {
                _db.Attach(topic);
                _db.Topic.Add(topic);
                _db.SaveChanges();
                long id = topic.Id;
                return(id);
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }