示例#1
0
 public bool ThisCountryIsRegistered(Country country)
 {
     using (DB_PriceContext PriceContext = new DB_PriceContext())
     {
         CountryFee result = PriceContext.listCountryPrices.Find(country);
         return(result != null);
     }
 }
示例#2
0
 public int GetPricePerMin(Country country)
 {
     using (DB_PriceContext PriceContext = new DB_PriceContext())
     {
         bool result = PriceContext.listCountryPrices.Any(cf => cf.Country == country);
         if (!result)
         {
             throw new Exception("Not Registered Country!");
         }
         CountryFee countryPrice = PriceContext.listCountryPrices.Single(cf => cf.Country == country);
         return(countryPrice.PricePerMin);
     }
 }
示例#3
0
 public void SetPricePerMin(CountryFee CF)
 {
     using (DB_PriceContext PriceContext = new DB_PriceContext())
     {
         bool result = PriceContext.listCountryPrices.Any(cf => cf.Country == CF.Country);
         if (!result)
         {
             PriceContext.listCountryPrices.Add(CF);
         }
         else
         {
             CountryFee countryPrice = PriceContext.listCountryPrices.Single(cf => cf.Country == CF.Country);
             countryPrice.PricePerMin = CF.PricePerMin;
         }
         PriceContext.SaveChanges();
     }
 }