// Constructor public MessageDisplayViewModel(Message message, string userName) { Message = message; MessageTypeRepository mtRep = new MessageTypeRepository(); if (null == Message.MessageTypeReference.EntityKey) { MessageTypes = new SelectList(mtRep.GetAll(), "Id", "Description"); } else { MessageTypes = new SelectList(mtRep.GetAll(), "Id", "Description", Message.MessageTypeReference.EntityKey.EntityKeyValues[0].Value); } EventTypeRepository etRep = new EventTypeRepository(); if (null == Message.EventTypeReference.EntityKey) { EventTypes = new SelectList(etRep.GetAll(), "Id", "Description"); } else { EventTypes = new SelectList(etRep.GetAll(), "Id", "Description", Message.EventTypeReference.EntityKey.EntityKeyValues[0].Value); } VideoRepository vRep = new VideoRepository(); if (null == Message.VideoReference.EntityKey) { MyVideos = new SelectList(vRep.FindAllVideosByUser(userName).ToList(), "Id", "Description"); } else { MyVideos = new SelectList(vRep.FindAllVideosByUser(userName).ToList(), "Id", "Description", Message.VideoReference.EntityKey.EntityKeyValues[0].Value); } if (!string.IsNullOrEmpty(userName)) { AppUserRepository userRepository = new AppUserRepository(); User = userRepository.GetByUserName(userName); } }
public ActionResult Index() { return(View(_videoRepository.FindAllVideosByUser(User.Identity.Name).ToList())); }