コード例 #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);
            }
        }
コード例 #2
0
        public virtual SysRoleModel GetById(string id)
        {
            if (IsExists(id))
            {
                tbl_SysRole  entity = m_Rep.GetById(id);
                SysRoleModel model  = new SysRoleModel();
                model.Id       = entity.Id;
                model.RoleId   = entity.RoleId;
                model.RoleName = entity.RoleName;
                model.IsShow   = entity.IsShow;

                return(model);
            }
            else
            {
                return(null);
            }
        }