var sqlCommand= "@ DELETE FROM table1 WHERE id = @Id
DELETE FROM table2 WHERE id = @Id ";
var isDeleted = db.Database
.ExecuteSqlCommand(sqlCommand, new SqlParameter("@Id", Id)) > 0;
The problem is that if the 2nd or any other statement fails, then the preceding one remains intact i.e. already deleted.
I want it to reverse if any of it fails and return false.
Note: it has to be done the same way, not in the stored procedure.