示例#1
0
        public void MessageMailBoxViewModel()
        {
            var model = new MessageMailBoxViewModel();

            Assert.AreNotEqual(model.Folders, null);
            Assert.AreNotEqual(model.Tags, null);
        }
示例#2
0
        public ActionResult Index(int? id)
        {
            var foldersForUser = messageService.GetAllFoldersForUser(SessionManager.CurrentUsername);
            var currentFolder = messageService.GetFolder(SessionManager.CurrentUsername, id);
            var mapper = AutoMapperConfiguration.GetMapper();

            var currentFolderViewModel = mapper.Map<UserMessageFolder, MessageMailBoxFolderViewModel>(currentFolder);
            currentFolderViewModel.Folders = mapper.Map<List<UserMessageFolder>, List<MessageMailBoxFolderViewModel>>(foldersForUser);

            var model = new MessageMailBoxViewModel()
            {
                CurrentFolder = currentFolderViewModel,
                Folders = mapper.Map<List<UserMessageFolder>, List<MessageMailBoxFolderViewModel>>(foldersForUser)
            };

            SessionManager.CurrentFolderId = currentFolder.Id;

            return View(model);
        }