Hello, Is it feasible to create MPA using ASP.NET MVC and AngularJS with BoilerPlate MPA architechture or Can we convert exiting AngularJS boilerplate SPA to MPA, just for Good URL naming and securities accessing URL of webAPP rather than Angular routing we would need server side routing authorisation based. Just for security purpose each time action called we can load data and AngularJS controller.
appriciates any help or suggestion. Thanks Aifaz
Below code workes for me and done like this way, Can you Please check if it is fine to deploy, Pls Suggest
[UnitOfWork] public ActionResult Index() { var adminRoleForDefaultTenant = new UserRole(); var role = new Role(); var UserId = _userManager.AbpSession.UserId; using (var unitOfWork = _unitOfWorkManager.Begin()) {
adminRoleForDefaultTenant = _context.DbContext.UserRoles.FirstOrDefault(r => r.UserId == UserId);
var roleID = adminRoleForDefaultTenant.RoleId;
role = _context.DbContext.Roles.FirstOrDefault(r => r.Id == roleID);
unitOfWork.Complete();
}
////Layout of the angular application.
if(role.Name.Equals("Admin"))
{
return View("~/App/Main/views/admin/adminlayout.cshtml");
}
else if (role.Name.Equals("Student"))
{
return View("~/App/Main/views/student/studentlayout.cshtml");
}
else{//..} }
Hello, I'm stuck in Checking role of users in Controller action(HomeController, Index action), below described my use case, I have tried as per documentation role management and user management on ASP.NET Boilerplate site but nothing works for me
I have to navigate users to their respective layout pages on the basis of their roles, here is my code as of now but I have to replace it with users role
// Home Comtroller public ActionResult Index() {
if (HttpContext.User.Identity.Name.Equals("admin")) {
return View("~/App/Main/views/admin/adminlayout.cshtml");
}
else if (HttpContext.User.Identity.Name.Equals("student"))
{
return View("~/App/Main/views/student/studentlayout.cshtml");
}
else{ //... }
}
urgent help would be appreciated, also I would like know how could we use external webservice call inside AngularJS or Boilerplate site.
Thanks Aifaz