public ActionResult Index() { string userLogon = User.Identity.Name; User currentUser = _userRepository.GetByLogonUser(userLogon); //If user isn't known yet in our database, get their data from ActiveDirectory and Create them in the database if (currentUser == null) { currentUser = _userRepository.CreateFromUserPrincipal(_userPrincipalRepository.GetByLogonUser(userLogon)); } //Only get todays objects for the homepage DateTime pageDate = DateTime.Now; ShoutPageViewModel indexViewModel = new ShoutPageViewModel() { Messages = _messageRepository.GetByDay(DateTime.Now), SOSList = _sosRepository.GetList(), Tags = _messageRepository.GetTagPopularityByDay(pageDate, true), Teams = _teamRepository.GetByDay(pageDate), MasterIncidents = _masterIncidentRepository.GetByDay(pageDate).Where(f => f.Active), CurrentUser = currentUser, KMList = _kmRepository.GetList() }; return(View(indexViewModel)); }
public ActionResult Index() { //Only get todays objects for the homepage DateTime pageDate = DateTime.Now; ShoutPageViewModel indexViewModel = new ShoutPageViewModel() { Messages = _messageRepository.GetByDay(pageDate), SOSList = _sosRepository.GetList(), Tags = _messageRepository.GetTagPopularityByDay(pageDate), Teams = _teamRepository.GetByDay(pageDate), MasterIncidents = _masterIncidentRepository.GetByDay(pageDate).Where(f => f.Active), CurrentUser = _userRepository.GetByLogonUser(User.Identity.Name) //Also registers the user if they don't exist yet }; return(View(indexViewModel)); }