コード例 #1
0
        public int ShareCube(CubeUserMappingModel model, OrmLiteConnectionFactory dbFactory)
        {
            int lastInsertedId = 0;

            using (var dbConn = dbFactory.OpenDbConnection())
            {
                dbConn.Save(model);
                lastInsertedId = model.Id;
            }
            return(lastInsertedId);
        }
コード例 #2
0
        public int CreateCube(CubeModel model, int userid, OrmLiteConnectionFactory dbFactory)
        {
            int lastInsertedId = 0;

            using (var dbConn = dbFactory.OpenDbConnection())
            {
                dbConn.Save(model);
                lastInsertedId = model.Id;
                CubeUserMappingModel mapping = new CubeUserMappingModel()
                {
                    CubeId       = lastInsertedId,
                    UserId       = userid,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    IsActive     = true
                };
                dbConn.Insert <CubeUserMappingModel>(mapping);
            }
            return(lastInsertedId);
        }