Example #1
0
        public static void UpdateValue(Targets_CoinsDB _UpdateValue)
        {
            var context = new DataBaseConnectionContext();

            context.Update(_UpdateValue);
            context.SaveChanges();
        }
Example #2
0
        public static void AddValue(Targets_CoinsDB _AddValue)
        {
            var context = new DataBaseConnectionContext();

            context.Add(_AddValue);
            context.SaveChanges();
        }
Example #3
0
        public SaveCoins(int _Year, double _ECCC, double _Euro, double _Dolars, double _Sek)
        {
            IEnumerable <Targets_CoinsDB> List = TargetsCoinsController.Load_Year(_Year);

            if (List.Count() == 0)
            {
                var NewRow = new Targets_CoinsDB
                {
                    Year = _Year,
                    ECCC = _ECCC,
                    Euro = _Euro,
                    USD  = _Dolars,
                    SEK  = _Sek,
                };
                TargetsCoinsController.AddValue(NewRow);
            }
            else
            {
                List.First().ECCC = _ECCC;
                List.First().Euro = _Euro;
                List.First().USD  = _Dolars;
                List.First().SEK  = _Sek;
                TargetsCoinsController.UpdateValue(List.First());
            }
        }