Ejemplo 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");
        }
Ejemplo n.º 2
0
 public ActionResult ListByCompany()
 {
     List<User> users = new List<User>();
     int companyID = 0;
     using (var um = new UserManager())
     {
         var currentUser = um.ByUsername(User.Identity.Name);
         if (currentUser.CompanyID != null)
         {
             companyID = currentUser.CompanyID.GetValueOrDefault();
         }
         users = um.ByCompany(companyID).OrderByDescending(u => u.CreatedOn).ToList();
         ViewBag.Users = users;
     }
     return View("List");
 }
Ejemplo n.º 3
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");
 }