Example #1
0
        public virtual bool Create(SysRoleModel model)
        {
            try
            {
                tbl_SysRole entity = m_Rep.GetById(model.Id);
                if (entity != null)
                {
                    return(false);
                }
                entity          = new tbl_SysRole();
                entity.Id       = model.Id;
                entity.RoleId   = model.RoleId;
                entity.RoleName = model.RoleName;
                entity.IsShow   = model.IsShow;


                if (m_Rep.Create(entity))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 根据主键获取一个角色
 /// </summary>
 /// <param name="id">角色的主键</param>
 /// <returns>一个角色</returns>
 public SysRole GetById(string id)
 {
     return(repository.GetById(db, id));
 }