예제 #1
0
        public static List<UserViewModel> ToListOfUserViewModel(List<User> users)
        {
            List<UserViewModel> usersInListOfUserViewModel = new List<UserViewModel>();

            foreach (User user in users)
            {
                UserViewModel userInUserViewModel = new UserViewModel(user);
                usersInListOfUserViewModel.Add(userInUserViewModel);
            }

            return usersInListOfUserViewModel;
        }
예제 #2
0
        public ActionResult CurrentUserJson()
        {
            UserViewModel currentUserViewModel = new UserViewModel();

            if (WebSecurity.IsAuthenticated)
            {
                int currentUserUserId = WebSecurity.CurrentUserId;
                User currentUser = UsersData.GetUserByUserId(currentUserUserId);
                currentUserViewModel = new UserViewModel(currentUser);
            }

            return Json(currentUserViewModel, JsonRequestBehavior.AllowGet);
        }