public ActionResult Delete(string uri)
        {
            // Container Name - picture
            BlobManager BlobManagerObj = new BlobManager("picture");

            BlobManagerObj.DeleteBlob(uri);
            return(RedirectToAction("Get"));
        }
Пример #2
0
        public ActionResult Delete(string absoluteUri)
        {
            BlobManager blobManager = new BlobManager("picture");

            blobManager.DeleteBlob(absoluteUri);

            return(RedirectToAction("Get"));
        }
Пример #3
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var documentModel = await _context.DocumentModel.SingleOrDefaultAsync(m => m.id == id);

            await BlobManager.DeleteBlob(_context, documentModel.Attachment);

            _context.DocumentModel.Remove(documentModel);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "Id,Student_No,Name,Surname,Email,Address,Mobile_No,Completed")] string id, string category, string uri)
        {
            // Container Name - picture
            BlobManager BlobManagerObj = new BlobManager("picture");

            BlobManagerObj.DeleteBlob(uri);

            await DocumentDBRepository <Student> .DeleteItemAsync(id, category);

            return(RedirectToAction("Index"));
        }
Пример #5
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var categoryModel = await _context.CategoryModel.SingleOrDefaultAsync(m => m.ID == id);

            await BlobManager.DeleteBlob(_context, categoryModel.Thumbnail);

            _context.CategoryModel.Remove(categoryModel);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #6
0
        public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "StudentID")] string id)
        {
            Student item = await DocumentDBRepository <Student> .GetItemAsync(id);

            if (item.ImageUrl != null)
            {
                BlobManager BlobManagerObj = new BlobManager("picture");
                BlobManagerObj.DeleteBlob(item.ImageUrl);
            }
            await DocumentDBRepository <Student> .DeleteItemAsync(id);

            return(RedirectToAction("Index"));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, DocumentModel documentModel, IFormFile AttachmentFile)
        {
            if (id != documentModel.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var documentModel_old = await _context.DocumentModel.AsNoTracking()
                                            .SingleOrDefaultAsync(m => m.id == id);

                    if (AttachmentFile != null && AttachmentFile.Length > 0)
                    {
                        await BlobManager.DeleteBlob(_context, documentModel_old.Attachment);

                        documentModel.Attachment =
                            await BlobManager.SaveBlob(_context, AttachmentFile);
                    }
                    else
                    {
                        documentModel.Attachment = documentModel_old.Attachment;
                    }

                    documentModel.TimeStamp = DateTime.Now;
                    _context.Update(documentModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DocumentModelExists(documentModel.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(documentModel));
        }
Пример #8
0
        public async Task <IActionResult> Edit(int id, CategoryModel categoryModel, IFormFile ThumbnailFile)
        {
            if (id != categoryModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var categoryModel_old = await _context.CategoryModel.AsNoTracking()
                                            .SingleOrDefaultAsync(m => m.ID == id);

                    if (ThumbnailFile != null && ThumbnailFile.Length > 0)
                    {
                        await BlobManager.DeleteBlob(_context, categoryModel_old.Thumbnail);

                        categoryModel.Thumbnail =
                            await BlobManager.SaveBlob(_context, ThumbnailFile);
                    }
                    else
                    {
                        categoryModel.Thumbnail = categoryModel_old.Thumbnail;
                    }
                    _context.Update(categoryModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryModelExists(categoryModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(categoryModel));
        }
Пример #9
0
        public async Task <ActionResult> DeleteFile(string nodeId, string name)
        {
            //Delete Blob
            BlobManager blobManager = new BlobManager();

            blobManager.DeleteBlob(name);


            //Delete from documentDB
            DocumentDBManager documentDB = new DocumentDBManager();
            await documentDB.RemoveBlobDocumentAsync(Settings.Default.DocumenDBDatabaseName, Settings.Default.DocumentDBCollectionName, nodeId, name);

            //Delet from list
            List <BlobModel> blobList;

            if (blobs.TryGetValue(nodeId, out blobList))
            {
                int index = blobList.FindIndex(b => b.Path == name);
                blobList.RemoveAt(index);
                blobs[nodeId] = blobList;
            }

            return(RedirectToAction("Index"));
        }