public void Add(Attachment attachment)
 {
     _attachments.Add(attachment);
 }
Example #2
0
        public void AddAttachment(ChatMessage message, string fileName, string contentType, long size, UploadResult result)
        {
            var attachment = new Attachment
            {
                Id = result.Identifier,
                Url = result.Url,
                FileName = fileName,
                ContentType = contentType,
                Size = size,
                Room = message.Room,
                Owner = message.User,
                When = DateTimeOffset.UtcNow
            };

            _repository.Add(attachment);
        }
 public void Add(Attachment attachment)
 {
     _db.Attachments.Add(attachment);
     _db.SaveChanges();
 }