ASP.NET-MVC Linq2Sql logic to get related items provided
I have a subcontracting table with a company field. On the company page, I don't want the company to be deleted if it is linked to an active subcontract. I am currently using the following expression to display the delete button. (Doesn't actually uninstall, just shuts down the company.)
<% if (item.company1.subcontracts.Count == 0) { %>
This works to exclude all companies that are attached to sub-contracts. However my subcontracting table also has an active_status field. I really want to be able to delete companies that are either not attached to a subcontract or attached to an inactive subcontract (active_status == 0).
+2
a source to share
2 answers