Beispiel #1
0
        public static InvestmentTracker investmentTracker(Account account)
        {
            InvestmentTracker invest = new InvestmentTracker
            {
                AccountNumber = account.AccountNumber
            };
            var temp = db.InvestmentTracker.FirstOrDefault(e => e.AccountNumber == account.AccountNumber);

            if (temp == null)
            {
                db.InvestmentTracker.Add(invest);
                db.SaveChanges();
                return(invest);
            }
            else
            {
                return(temp);
            }
        }
Beispiel #2
0
        public static void AddYear(int year, double value, InvestmentTracker invest, double valueInflation)
        {
            YearTracker addyear = new YearTracker(year, value, valueInflation);

            var DByear = db.YearTracker.FirstOrDefault(e => e.TrackingNumber == invest.TrackingNumber && e.Year == year);

            if (DByear == null)
            {
                addyear.TrackingNumber = invest.TrackingNumber;
                db.YearTracker.Add(addyear);
                db.SaveChanges();
            }
            else
            {
                DByear.Year          = year;
                DByear.Value         = value;
                DByear.ValueInflated = valueInflation;
                db.YearTracker.Update(DByear);
                db.SaveChanges();
            }
        }
Beispiel #3
0
 public static IEnumerable <YearTracker> GetAllYears(InvestmentTracker Invest)
 {
     return(db.YearTracker.Where(e => e.TrackingNumber == Invest.TrackingNumber).OrderBy(t => t.Year));
 }