public List <TopicViewModel> GetTopicsForUserVM(ConnectCreateUserViewModel conUser) { List <Topic> AllTopics = Repository.GetTopicsByUserId(conUser.UserId).ToList(); List <TopicViewModel> AllTopicsVM = new List <TopicViewModel>(); if (AllTopicsVM != null) { foreach (Topic topic in AllTopics) { TopicViewModel tvm = new TopicViewModel(currentUserVM); tvm.TopicId = topic.ID; tvm.TopicName = topic.Name; tvm.TopicImage = "TopicImage.png"; //SDI:Same image for all topics AllTopicsVM.Add(tvm); } } return(AllTopicsVM); }
/// <summary> /// Get all users from the DB /// </summary> /// <returns></returns> public List <ConnectCreateUserViewModel> GetUsersVM() { List <User> AllUsers = Repository.GetUsers().ToList(); List <ConnectCreateUserViewModel> AllUsersVM = new List <ConnectCreateUserViewModel>(); if (AllUsers != null) { foreach (User user in AllUsers) { ConnectCreateUserViewModel uvm = new ConnectCreateUserViewModel(); uvm.UserId = user.ID; uvm.LoginName = user.LoginName; uvm.loginImage = user.LoginName + ".png"; AllUsersVM.Add(uvm); } } return(AllUsersVM); }
private string topicImage = string.Empty; //SDI: the image is local to the viewmodel for simplification public TopicViewModel(ConnectCreateUserViewModel _curUserVM) { topic = new Topic(); currentUserVM = _curUserVM; }