Пример #1
0
        public void DeleteAdditionalDocument(string productId, string documentId)
        {
            if (string.IsNullOrEmpty(productId) || string.IsNullOrEmpty(documentId))
            {
                return;
            }

            var documentID = int.Parse(documentId);
            var productID  = int.Parse(productId);

            var product  = GetProduct(productID);
            var document = product.ProductDocuments.FirstOrDefault(a => a.Id == documentID);

            FileProcessor fileProcessor = new FileProcessor();

            var deleteRes = fileProcessor.DeleteFile(document.PathToDocument);

            if (deleteRes)
            {
                DeleteDocument(document.PathToDocument);
            }
        }