public ActionResult Index()
{
var user =
RepositoryFactory.UserRepository.Queryable.SingleOrDefault(x => x.Identifier == CurrentUser.Identity.Name);
if (user == null)
{
return RedirectToAction("Create", "Profile");
}
var roles = user.Roles.ToList();
if (roles.Any(x => x.Id == RoleNames.Student))
{
return RedirectToAction("Index", "Student");
}
if (roles.Any(x => x.Id == RoleNames.Instructor))
{
return RedirectToAction("Index", "Instructor");
}
if (roles.Any(x => x.Id == RoleNames.Administrator))
{
return RedirectToAction("Index", "Landing", new { area = "Admin" });
}
return new HttpUnauthorizedResult();
}