Пример #1
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="model">新实体</param>
        /// <returns></returns>
        public bool Edit(SYS_MENU_BUTTON model)
        {
            bool success = false;

            using (var dbcontext = DbFactory.Create())
            {
                try
                {
                    dbcontext.Update(model);
                    dbcontext.Save();
                    success = true;
                }
                catch (Exception ex)
                {
                    success = false;
                    Logger.Error(string.Format("SYS_MENU_BUTTON_BLL 编辑记录异常,异常信息:{0}", ex.ToString()));
                }
            }
            return(success);
        }
Пример #2
0
        /// <summary>
        /// 根据条件获取列表
        /// </summary>
        /// <param name="querymodel">条件</param>
        /// <returns></returns>
        public List <SYS_MENU_BUTTON> GetList(SYS_MENU_BUTTON querymodel)
        {
            List <SYS_MENU_BUTTON> list = null;

            using (var dbcontext = DbFactory.Create())
            {
                try
                {
                    int id = Convert.ToInt32(querymodel.ID);
                    Expression <Func <SYS_MENU_BUTTON, bool> > exp  = a => a.ID == id;
                    Expression <Func <SYS_MENU_BUTTON, bool> > temp = a => 1 == 1;
                    exp  = CompileLinqSearch.AndAlso(exp, temp);
                    list = dbcontext.Find(exp);
                }
                catch (Exception ex)
                {
                    Logger.Error(string.Format("SYS_MENU_BUTTON_BLL 根据条件获取列表异常,异常信息:{0}", ex.ToString()));
                }
            }
            return(list);
        }