예제 #1
0
        public async Task Delete(PnpFile pnpFile)
        {
            var client = await GetDocumentDbClient();
            var pnpFileToDelete = client.CreateDocumentQuery<Document>(DocumentCollection.DocumentsLink).Where(d => d.Id == pnpFile.Id.ToString()).AsEnumerable().FirstOrDefault();

            if (pnpFileToDelete != null)
                await client.DeleteDocumentAsync(pnpFileToDelete.SelfLink);
        }
예제 #2
0
        public async Task Insert(PnpFile pnpFile)
        {
            try
            {
                var client = await GetDocumentDbClient();
                var document = client.CreateDocumentQuery("dbs/" + DocumentDbId + "/colls/" + _collectionId).Where(d => d.Id == pnpFile.Id.ToString()).AsEnumerable().FirstOrDefault();

                if (document == null)
                {
                     client.CreateDocumentAsync("dbs/" + DocumentDbId + "/colls/" + _collectionId, pnpFile).Wait();
                }
            }
            catch (Exception exception)
            {
                var t = exception;
                throw;
            }
        }
예제 #3
0
 public async Task Delete(PnpFile pnpFile)
 {
     await _pnpFileRepository.Delete(pnpFile);
 }
예제 #4
0
 public async Task Update(PnpFile newPnpFile, PnpFile oldPnpFile)
 {
     await _pnpFileRepository.Update(newPnpFile, oldPnpFile);
 }
예제 #5
0
 public async Task Insert(PnpFile pnpFile)
 {
     await _pnpFileRepository.Insert(pnpFile);
 }
예제 #6
0
 public async Task Update(PnpFile oldPnpFile, PnpFile newPnpFile)
 {
     await Delete(oldPnpFile);
     await Insert(newPnpFile);
 }
 public SiteTemplateViewModel(PnpFile pnpModel)
 {
     //PnpProvisioningTemplate = pnpModel.PnpTemplate;
     UsesDefaultTemplateFiles = true; //todo: make it changeable
 }
예제 #8
0
        public PnpFile ToPnpFile()
        {
            var returnValue = new PnpFile()
            {
                Id = Id,
                Filename = file.FileName,
                PnpTemplate = ToPnpProvisioningTemplate()
            };

            return returnValue;
        }