Example #1
0
        /// <summary>
        /// 此函数用来增加一条电影院评论
        /// </summary>
        /// <param name="newComment"></param>
        /// <returns></returns>
        /// <exception>数据库插入异常</exception>
        public bool InsertCinemaComment(CINAME_COMMENT newComment)
        {
            //创建数据库实体类对象
            _entity = new WATCHMOVIEEntities();

            bool isSucceed = false;

            //添加记录到内存
            _entity.AddToCINAME_COMMENT(newComment);

            //保存修改到数据库
            try
            {
                int i = _entity.SaveChanges();
                isSucceed = true;
            }
            catch (Exception ex)
            {
                //异常处理?
                Console.WriteLine(ex);
                return(false);
            }

            //撤销entity对象
            _entity.Dispose();

            return(isSucceed);
        }