public async Task <SimsAttachmentFileInfo> AddAttachment(string filePath, string filename, int hostId)
        {
            var signalLibrary = AppExtensions.GenerateSignalsId(hostId);
            var item          = await attachments.AddAttachment(filePath, filename, signalLibrary);

            return(await dbHost.Incidents.Attachments.Add(hostId, item.url));
        }
        public async Task <SimsAttachmentFileInfo> AddAttachment(string filePath, string filename, int hostId)
        {
            if (!await this.dbHost.Incidents.IsClosed(hostId))
            {
                var incidentLibrary = AppExtensions.GenerateIncidentId(hostId);
                var item            = await attachments.AddAttachment(filePath, filename, incidentLibrary);

                return(await dbHost.Incidents.Attachments.Add(hostId, item.url));
            }
            else
            {
                throw new SimsIncidentClosedException("Incident closed, cannot upload attachment");
            }
        }
        public async Task <IEnumerable <SimsAttachmentFileInfo> > FetchAllAttchmentsLinks(int hostId)
        {
            var incidentLibrary = AppExtensions.GenerateIncidentId(hostId);
            var fileDat         = await attachments.FetchAllAttchmentsLinks(incidentLibrary);

            var dbData = await dbHost.Incidents.Attachments.Get(hostId);

            var allData = from file in fileDat
                          join db in dbData
                          on file.Url equals db.Url
                          select new SimsAttachmentFileInfo
            {
                FileName = file.FileName,
                Url      = file.Url,
                Tags     = db.Tags,
                Created  = db.Created,
                UserId   = db.UserId
            };

            return(allData.ToList());
        }
        public Task <SimsAttachmentLibraryInfo> EnsureLibrary(int hostId)
        {
            var incidentLibrary = AppExtensions.GenerateIncidentId(hostId);

            return(attachments.EnsureLibrary(incidentLibrary));
        }
        public Task <SimsAttachmentLibraryInfo> EnsureLibrary(int hostId)
        {
            var signalLibrary = AppExtensions.GenerateSignalsId(hostId);

            return(attachments.EnsureLibrary(signalLibrary));
        }