Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How get the property of another class

$
0
0

I want to do a multipication of 2 properities from 2 difrent class models

I tryed using Dependncy Injection but did not know  how to do it, How can I do that ?

   

    public class Product
    {
        public int productId { get; set; }
       public decimal price { get; set; }
        public decimal dolarprice
        {
            get
            {
                return price * tipo; //How to get tipo from the other table Dolar
            }
        }

    }

    public class Dolar
    {
        public int dolarId{ get; set; }

        public decimal tipo { get; set; }
        
    }

 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>