Esempio n. 1
0
        public ActionResult List(int? companyID)
        {
            List<User> users = new List<User>();
            using (var um = new UserManager())
            {
                // any user tied to a company can only see their users
                var currentUser = um.ByUsername(User.Identity.Name);
                if (currentUser.CompanyID != null)
                {
                    companyID = currentUser.CompanyID;
                }

                users = companyID != null ? um.ByCompany(companyID.GetValueOrDefault()).OrderByDescending(u => u.CreatedOn).ToList()
                    : um.All().OrderByDescending(u => u.CreatedOn).ToList();
                ViewBag.Users = users;
            }
            return View("List");
        }
Esempio n. 2
0
 public ActionResult ListAll(int? companyID)
 {
     List<User> users = new List<User>();
     using (var um = new UserManager())
     {
         users = companyID != null ? um.ByCompany(companyID.GetValueOrDefault()).OrderByDescending(u => u.CreatedOn).ToList()
             : um.All().OrderByDescending(u => u.CreatedOn).ToList();
         ViewBag.Users = users;
     }
     return View("List");
 }