Plaintiffs seek in this action to recover upon the quantum meruit for the labor and materials furnished to the defendant in drilling a well on his farm in Dickey county, in this state. The case *611was tried to a jury, and resulted in a directed verdict in defendant’s favor; and plaintiffs have appealed from the judgment entered upon the verdict.
The case before us is a sequel to Kupfer et al. v. McConville, 161 N. W. 283. In that action the plaintiffs sought to foreclose a mechanic’s lien filed by them for the construction of the well in controversy here. As stated in the opinion in that case, the well was constructed under a specific contract. And it was there held that the plaintiffs had not performed their contract so as to entitle them to compensation according to its terms.
In this case the defendant pleaded the judgment in the former action as a bar. The judgment roll in the former action, including the findings of the district court, was offered in evidence upon the trial of this case, and the court was requested to take judicial notice of the decision of this court in the former case. And it was contended by the defendant that the facts found in the former case upon the issues there presented cannot be relitigated in this case; and that these facts, together with the undisputed testimony ,in this case, precludes a recovery on the part of the plaintiffs in this action. The trial court agreed with these contentions, and directed a verdict in favor of the defendant for a dismissal of the action.
On this appeal appellants contend: (1) That the judgment in the action to foreclose the mechanic’s lien is not res judicata in this action; and, (2) that under the rule announced by this court in Horton v. Emerson, 30 N. D. 258, 152 N. W. 529, they are entitled to recover on the quantum meruit for the reasonable value to the owner, not exceeding the contract price, of the labor and materials which they furnished in drilling the well in controversy.
1. There is no question but that a judgment rendered in an action to foreclose a mechanic’s lien is not necessarily a bar to an action brought to recover on the quantum meruit. See Horton v. Emerson, 30 N. D. 258, 152 N. W. 529, and authorities cited therein.
“When the second action between the same parties is upon a different claim or demand or cause of action, it is well settled that the judgment in the first suit operates as an estoppel only as to the point or question actually litigated and determined, and not as to other matters which might have been litigated and determined. This rule holds true whether the *612judgment is used in pleading as a technical estoppel, or is relied on by way of evidence as conclusive per se. In all cases it should appear that the first judgment determined the actual question at issue between the parties, and that the precise question was raised and determined in the former suit. On the other hand, it is equally well settled that a fact •which has been directly tried and decided by a court of competent jurisdiction cannot be contested again between the same parties in the same or any other court; and that where some controlling fact or question material to the determination of both actions has been determined in a former suit, and the same fact or question is again at issue between the same parties, its adjudication in the first will if properly presented be conclusive of the same question in the latter suit, without regard to whether the cause of action is the same or not, or whether the second suit involves the same or a different subject-matter, or whether or not it is in the same form of proceeding. In such cases it is also immaterial that the two actions -Were based on different grounds, or tried on different theories, or are instituted for different purposes, and seek different'relief. A matter, whether consisting of one or many questions, which has been solemnly adjudicated by a court of competent jurisdiction, must, in any subsequent litigation beljween the -Isame piartEes, where the same question or questions arise, be deemed to have been finally and conclusively settled, except where the litigation is a direct proceeding for the purpose of reversing or setting aside such adjudication.” 15 R. C. L. pp. 973-975-
These principles were recognized in Horton v. Emerson, supra. In the opinion in that case it was pointed out that the trial judge, in deciding Lhe action to foreclose a mechanic’s lien, had expressly refused to find bad faith and intentional and wilful departure from the terms of the contract by the contractor; that he had merely held “that no recovery could be had-by plaintiffs on the contract,” and -that he had “studiously avoided making any finding or conclusion which would in the least hamper or interfere with plaintiff’s right to recover upon the quantum meruit.” 30 N. D. 264, 152 N. W. 531. There can, we think, be no doubt but that the findings of fact made in the former action are binding upon the parties in this case. In that case there was an issue as to the terms of the contract between the parties. There was also an issue as to what plaintiffs had done; that is, as to what kind of a well they had drilled. In that case the plaintiffs claimed that they had in fact *613•drilled a well having adequate water. The defendant claimed, not only that they had failed to construct a well of the kind agreed upon, but that they had not in fact constructed a well at all.. The trial court found that the agreement between the parties was that plaintiffs should sink the well “to the level of a well then owned by one McGannon, a neighbor of the defendant and that the whole agreement between the parties, including both the writing and the oral agreement, was to the effect that in consideration of the payment of $700 plaintiffs should furnish to defendant a flow well, providing such well could be obtained by sinking the well 50 feet deeper than the said well belonging, to the said McGannon, and that if a flow well could not be obtained by going to the depth as stated, then plaintiffs should furnish to defendant a pump well that would furnish water suitable for stock and domestic purposes and in reasonable quantities; that the said McGannon well is of a depth of about 1,400 feet, and the well sunk by plaintiffs for defendant was only 1,315 feet; that plaintiffs did not furnish defendant a flow well; that by the terms of the contract plaintiffs guaranteed the well for one year; that plaintiffs did not furnish defendant any kind of a well that furnished suitable water for stock and domestic purposes for one year.”
These findings were specifically approved by this court. 161 N. W. 287. There is no contention, and no evidence tending to show, that the defendant either actually or impliedly accepted the well or consented that the plaintiffs might cease to drill at the depth they had reached. On thf contrary, the plaintiffs themselves specifically testified that the defendant was angry when they stopped drilling, and insisted that they drill to a greater depth. They admit that he never accepted the well. They also admit that they made no further attempt, or offer, to complete the work in accordance with the terims of the contract, as that contract was determined to be by the former decision of this court. It appears from the testimony that the land in controversy is situated in a basin where artesian water is obtained at a certain depth. While it is impossible to say under the evidence before us whether an artesian well would or would not have been obtained if the plaintiffs had drilled to the depth agreed upon, the evidence .is to the effect that it could not possibly have been obtained at the depth reached by the plaintiffs, but that it might have been obtained if the plaintiffs had drilled to the depth stipulated in their contract. There was no evidence adduced at all as to *614what the well, as constructed by the plaintiffs was worth. Nor was there any evidence as to what it would cost to complete the well by drilling to the depth -stipulated in the contract. The only evidence adduced by the plaintiffs was as to the value of the material utilized and services performed in drilling. Hence the following facts stand undisputed : That the plaintiffs agreed to furnish to the defendant a flowing well, provided such well could be obtained by drilling to a depth of 1,450-feet; that if a flowing well could not be obtained by going to that depth then the plaintiff should furnish to the- defendant a pump well that would furnish water suitable for stock and domestic purposes in reasonable quantities; that the plaintiffs abandoned the work when they had drilled to a depth of 1,315 feet, without having produced a well at all; that such abandonment was in no manner acquiesced in by the defendant, but took place over his protest; that the plaintiffs have at no time completed, attempted to complete, or even offered to complete, the work in accordance with the contract, as that contract was determined to be by the former decision of this court; that the plaintiffs have failed to show that the well, as constructed by them, added to the value of defendant’s land, or what, if any, value the well had as the same was constructed by them. In these circumstances can it be said that the plaintiffs have brought themselves within the rule enunciated in Horton v. Emerson, supra, so as to permit them to recover on quantum meruit? After a careful consideration of this question we have arrived at the conclusion that it must be answered in the negative.
It will be noted that in Horton v. Emerson, supra, this court quoted with approval the rule laid down by Sutherland in his work on Damages, which reads, in part, as follows:
“The contractor must have intended in good faith to fulfill the terms of the contract; its.spirit must be faithfully observed, though the very letter of it fail. A voluntary abandonment or a wilful departure from its stipulations is not allowed.” 3 Sutherland on Damages (3d ed.) § 711; 30 N. D. 270, 152 N. W. 529.
Among the authorities cited in the last edition of Sutherland (see 3 Sutherland on Damages 4th ed. § 711, p. 2677) in support of the proposition thus stated in Bowen v. Kimbell, 203 Mass. 364, 89 N. E. 542, 133 Am. St. Rep. 302. In the decision in that case the Supreme Court of Massachusetts said:
“It has .always been held that he (the contractor) cannot recover upom *615s. quantum meruit unless he has acted in good faith under the contract, in an endeavor to perform it. Burke v. Coyne, 188 Mass. 401, 74 N. E. 94; Sipley v. Stickney, 190 Mass. 43, 112 Am. St. Rep. 309, 75 N. E. 226, 5 L. R. A. (N. S.) 469, 5 Ann. Cas. 611. If he abandons the contract without excuse when he has only half performed it, he has no remedy. Homer v. Shaw, 177 Mass. 1, 58 N. E. 160. In both these particulars the contractor is governed by the same rules as those which are adopted generally in other states.” 203 Mass. 371, 89 N. E. 544, 133 Am. St. 306.
In this case it is established, either by conclusive or by undisputed ■evidence, that the plaintiffs failed to comply wlith the terms of their contract with the defendant; that they, in fact, failed to construct a well at all; that they ceased drilling, and took away their outfit, and left the Well in the condition found by the trial court in the findings in the former suit, over and in spite of the protest of the defendant; that even .after the terms of the contract had been definitely and conclusively established by the decision of this court, not even an offer wfas made by the plaintiffs to comply with the terms of such contract. It will also be noted ‘that the plaintiffs failed to show the value of the well as constructed by them, or that it in fact had any value as such or that it added to the value of defendant’s land. In other'words, plaintiffs failed to make out a prima facie casé, and there was no evidence on which the jury could base a verdict in favor of the- plaintiffs. In the quotation from Sutherland on Damages, approved and adopted in Horton v. Emerson, it is said:
“The sole ground upon which a contractor is entitled to anything under' this rule is that if he were not paid something the defendant would profit at his expense, although his claim is without merit as far .as rights under the contract are concerned. Hence the amount which may be recovered is the amount by which, were no payment made, the defendant would profit at the plaintiff’s expense; that is to say, the amount which represents the fair market value of the structure which, ■against the wishes of the defendant, has been put upon his land. This value the plaintiff must prove before he can recover. If the contract is a beneficial one to the landowner the contractor is not entitled to recover any margin of the benefit which the former secured by the making of the contract; but the contractor is entitled to the value of' the building as it is in the light of the landowner’s right to have the building built, and properly built, for the contract price. If, for example, the *616landowner secured by his contract the erection for $2,000 of a building worth $3,000, and the plaintiff, in erecting the building, fails to comply with the'contract in matters going to the essence of the contract, and the building, erected as it is erected, is worth $2,500, the plaintiff is not entitled to recover $2,500; all that he is entitled to recover is 25/30 of $2,000.”
In support of the rule so stated, Sutherland (Sutherland on Damages 3d ed. § 711) cites Gillis v. Cobe, 177 Mass. 584, 59 N. E. 455. That action was one for work done and materials furnished in the construction of a building which the plaintiff had contracted to build, but failed to construct to the satisfaction of the architect, whose approval was required by his contract, which also required the plaintiff to ram the cinder filling on which the concrete floor of the building was laid. When certain heavy tanks for which the building had been designed were put in place there was so great a sinking of the floor that the damage caused thereby was greater than the value of. the work and materials furnished by the plaintiff. The cause of the sinking of the floor was not shown. It was held that in order to recover the plaintiff must show that the building as it existed had a market value and added ho the value of the defendant’s land; that the burden was not upon the defendant to show that the sinking of the floor was due to the failure of the plaintiff to perform this contract, and that the plaintiff could not recover the value of his work and materials diminished by such damages as the defendant could prove in recoupment. In the opinion in the case the Massachusetts court said:
“It is plain, therefore, that the plaintiff who seeks a recovery under the principle of Hayward v. Leonard for work done under a special contract does not recover on the same ground as that on which a plaintiff recovers who has done work as he has been requested to do. So far as his case travels on that ground, he is out of court; his sole claim to be paid anything is that if he is not paid the defendant will profit at his. expense; until he has proved that the defendant will in that case profit at his expense, he has not made out a prima facie case to be paid anything, and until he has proved how much that profit will be his prima facie case is not complete. When the fact appears in evidence that the work for which money is sought was done under a special contract, and that the plaintiff cannot recover under the special contract, but still seeks a recovery, there is no question of the value of his Work and materials, proved *617in the usual way, and he does not make out a prima facie case by proving their value according to regular rules. To make out a case for recovery for such work and materials so furnished, he must prove how much the result of his work had benefited the defendant; he must prove what the fair market value of the thing produced by his misdirected work is; and, until he has done that, he has not made out even a prima facie case on which he is entitled to recover anything.” 177 Mass. 594, 59 N. E. 455-
The language of the Massachusetts court is directly applicable here. It follows from what has been said that the plaintiffs failed to establish a cause of action. There was no issue of fact to submit to the jury, and the trial court was correct in directing a verdict in favor of the defendant for a dismissal of the action.
Robinson, Bronson, and Birdzell JJ., concur.