예제 #1
0
 public JResult GetAllRole(BaseRoleModel model)
 {
     return _baseservice.GetAllRole(model);
 }
예제 #2
0
 /// <summary>
 /// 添加角色信息 
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddRole(BaseRoleModel model)
 {
     const string sql = @"INSERT INTO `sys_role`
                         (`innerid`, `name`, `remark`, `isenabled`)
                         VALUES
                         (uuid(), @name, @remark, 1);";
     using (var conn = Helper.GetConnection())
     {
         try
         {
             conn.Execute(sql, model);
             return 1;
         }
         catch (Exception ex)
         {
             return 0;
         }
     }
 }
예제 #3
0
 /// <summary>
 /// 获取所有角色
 /// </summary>
 /// <returns></returns>
 public IEnumerable<BaseRoleModel> GetAllRole(BaseRoleModel model)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append(@"select * from sys_role where isenabled=1 ;");
     var menuList = Helper.Query<BaseRoleModel>(sql.ToString());
     return menuList;
 }
예제 #4
0
 /// <summary>
 /// 编辑角色信息  
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int UpdateRole(BaseRoleModel model)
 {
     var sql = new StringBuilder("update `sys_role` set ");
     sql.Append(Helper.CreateField(model).Trim().TrimEnd(','));
     sql.Append(" where innerid = @innerid");
     int result;
     try
     {
         result = Helper.Execute(sql.ToString(), model);
     }
     catch (Exception ex)
     {
         result = 0;
     }
     return result;
 }