Esempio n. 1
0
        public ICollection <JustSentMessage> Save(string filePath, int userId, IEnumerable <int> receiverIds)
        {
            var messages = new List <JustSentMessage>();

            foreach (var receiverId in receiverIds)
            {
                //string[] filePathsplit = filePath.Split('/');
                //string copyPath = "/" + userId.ToString() + "/" + filePath.Replace("/" + userId.ToString(), receiverIds.ToString());
                var message = new StickMan_Users_AudioData_UploadInformation
                {
                    AudioFilePath = filePath,
                    UserID        = userId,
                    RecieverID    = receiverId,
                    ReadStatus    = false,
                    DeleteStatus  = false,
                    UploadTime    = DateTime.UtcNow
                };

                _unitOfWork.Repository <StickMan_Users_AudioData_UploadInformation>().Insert(message);
                _unitOfWork.Save();

                var justSentMessage = _messageConverter.MapToJustSentMessage(message, receiverId);
                messages.Add(justSentMessage);
            }

            return(messages);
        }