public void AddConversation(string userId, ConversationViewModel conversationModel)
 {
     var model = ModelConverters.ToConversationModel(conversationModel);
     model.ConversationAvatarFilePath = FilePathContainer.ConversationCoversPathRelative +
                                                        "/DefaultConversation.jpg";
     _conversationRepository.AddConversation(userId, model);
 }
 public static Conversation ToConversationModel(ConversationViewModel conversationViewModel)
 {
     Mapper.CreateMap<ConversationViewModel, Conversation>();
     return Mapper.Map<ConversationViewModel, Conversation>(conversationViewModel);
 }
 public JsonResult GetConversationPeople(ConversationViewModel conversationViewModel)
 {
     return Json(_conversationService.GetConversationPeople(conversationViewModel.ConversationId), JsonRequestBehavior.AllowGet);
 }
 public JsonResult GetConversationMessages(ConversationViewModel conversationViewModel)
 {
     var userId = User.Identity.GetUserId();
     return Json(_conversationService.GetConversationMessages(conversationViewModel, userId), JsonRequestBehavior.AllowGet);
 }
 public ActionResult AddConversation(ConversationViewModel conversationViewModel)
 {
     var userId = User.Identity.GetUserId();
     _conversationService.AddConversation(userId, conversationViewModel);
     return new EmptyResult();
 }
 public List<MessageViewModel> GetConversationMessages(ConversationViewModel conversationViewModel, string userId)
 {
     var messages = _conversationRepository.GetConversationMessages(userId,
         ModelConverters.ToConversationModel(conversationViewModel));
     var resultList = new List<MessageViewModel>();
     resultList.AddRange(messages.Select(ModelConverters.ToMessageViewModel));
     foreach (var message in resultList)
     {
         message.MessageSongs = new List<SongViewModel>();
         var songs = _conversationRepository.GetMessageSongs(message.MessageId);
         message.MessageSongs.AddRange(songs.Select(ModelConverters.ToSongViewModel));
     }
     return resultList;
 }
 public void RemoveConversation(string userId, ConversationViewModel conversationViewModel)
 {
     _conversationRepository.RemoveConversation(userId, ModelConverters.ToConversationModel(conversationViewModel));
 }
        public List<SongViewModel> GetConversationSongs(ConversationViewModel conversation)
        {
            var result = new List<SongViewModel>();
            if (string.IsNullOrEmpty(conversation.PlaylistId) == false)
            {
                var songs = _playlistRepository.GetSongs(conversation.PlaylistId);
                if (songs != null)
                {
                    result.AddRange(songs.Select(ModelConverters.ToSongViewModel));
                }
            }

            return result;
        }