public void DeleteProcedureFile(string documentId, int procedureId) { if (documentId == null || procedureId == 0) { throw new ArgumentNullException(); } var targetFolder = Server.MapPath($"~/Upload/Documents/Procedures/"); var procedure = _procedureService.GetItem(procedureId); var documentID = int.Parse(documentId); var document = procedure.ProcedureDocuments.FirstOrDefault(a => a.Id == documentID); var deleteRes = DeleteFile(document.PathToDocument, targetFolder); if (deleteRes) { //procedure.ProcedureDocuments.Remove(document); //_procedureService.Update(procedure); _procedureService.DeleteDocument(document.PathToDocument); } }