0
Good afternoon, I am developing a registration system with Angularjs and C#, when registering a new user there are two types of users to choose, administrator and librarian, being administrator type 1 and librarian type 2. and a menu with the following options: condominium, book, resident and user, when a user of the type librarian log in I want the condominium option not to be present in the menu, I have already created a method for this, but I would like to know how to use it along with the menu html file
Method code:
public void UserType(string usuario)
{
var db = new CRMEntities();
object user;
try
{
user = db.Usuario.Where(p => p.usuario1 == usuario).FirstOrDefault();
}
catch (Exception ex)
{
user = null;
}
var returnJson = "";
if (user == null)
returnJson = JsonConvert.SerializeObject(null);
else
returnJson = JsonConvert.SerializeObject(((Usuario)user).grupoUsuario);
ReturnJson(returnJson);
}
Menu code:
<ul class="nav" id="side-menu">
<li>
<a href="#!/"><span class="nav-label">Painel</span><span class="fa arrow"></span> </a>
</li>
<li>
<a href="#"><span class="nav-label">Cadastro</span><span class="fa arrow"></span> </a>
<ul class="nav nav-second-level">
<li><a href="#!/condominio">Condomínio</a></li>
<li><a href="#!/livro">Livro</a></li>
<li><a href="#!/morador">Morador</a></li>
<li><a href="#!/usuario">Usuário</a></li>
</ul>
</li>
</ul>
<script>
$(document).ready(function () {
$('#side-menu').metisMenu();
});
</script>
Pass the information to your model at
AngularJS
and uses the directiveng-show
– Ricardo Pontual