Exemple #1
0
        public async Task <InvestorResponse> UpdateAsync(int id, Investor investor)
        {
            var existingInvestor = await investorRepository.FindById(id);

            if (existingInvestor == null)
            {
                return(new InvestorResponse("Investor not found"));
            }

            existingInvestor.Description = investor.Description;
            existingInvestor.ImageUrl    = investor.ImageUrl;
            existingInvestor.FirstName   = investor.FirstName;
            existingInvestor.LastName    = investor.LastName;
            existingInvestor.City        = investor.City;
            existingInvestor.Description = investor.Description;

            try
            {
                investorRepository.Update(existingInvestor);
                await unitOfWork.CompleteAsync();

                return(new InvestorResponse(existingInvestor));
            }
            catch (Exception ex)
            {
                return(new InvestorResponse($"An error ocurred while updating the investor: {ex.Message}"));
            }
        }
 public void populateFields(Investor investor)
 {
     textBoxTotalInvest.Text = investor.totalInvest.ToString();
     textBoxTotalRetiro.Text = investor.totalRetiros.ToString();
     //TODO: TRABAJAR EN ESTO DEL SALDO.. create a new report service
     textBoxSaldo.Text = (investor.totalInvest - investor.totalRetiros).ToString();
 }
Exemple #3
0
        private async Task CreateTestInvestorInTableStorage(Investor investor)
        {
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.PostAsJsonAsync($"https://investfunctionappdemotest.azurewebsites.net/api/testing/createinvestor?code={CreateInvestorFunctionKey}", investor);

            response.EnsureSuccessStatusCode();
        }
Exemple #4
0
        public async Task <Report> GenerateReports(Investor investor, IEnumerable <SimulationResult> results)
        {
            var date      = results.First().Date.ToString("dd MMM yyyy");
            var coverPage = GetCoverPage();
            var summary   = await GetSummaryReportAsync(investor, results);

            var marketReport    = GetMarketReport();
            var strategyReports = await GetStrategyReportsAsync(results);

            // temporary
            var json  = JsonConvert.SerializeObject(results, Formatting.Indented);
            var bytes = Encoding.ASCII.GetBytes(json);

            summary.AddJsonFile("results", bytes);

            return(new Report
            {
                Title = $"Market Report {date}",
                Contents = new[]
                {
                    coverPage,
                    summary,
                    marketReport
                }
                .Union(strategyReports)
                .ToArray()
            });
        }
        public IEnumerable <SimulationState> Evaluate(
            IStrategy strategy,
            Investor investor,
            DateTime?endDate = null,
            ProgressBar _    = null)
        {
            var state = new SimulationState();

            foreach (var data in _dataCache.TakeUntil(endDate))
            {
                var shouldBuy = _simulationCache.GetOrCreate((strategy, data.Date), () => ShouldBuy(strategy, data));

                state = state.UpdateState(data, shouldBuy);
                state.AddFunds(investor.DailyFunds);
                state.ExecuteOrders();

                if (state.ShouldBuy)
                {
                    var funds = strategy.GetStake(data.Date, state.TotalFunds);
                    state.AddBuyOrder(investor.OrderBrokerage, investor.OrderDelayDays, funds);
                }

                yield return(state);
            }
        }
Exemple #6
0
        public IActionResult Create(InvestorViewModel investor)
        {
            if (ModelState.IsValid)
            {
                Investor investorObj = new Investor()
                {
                    CompanyName   = investor.CompanyName,
                    InvestorName  = investor.InvestorName,
                    Email         = investor.Email,
                    LandPhone     = investor.LandPhone,
                    Mobile        = investor.Mobile,
                    Address       = investor.Address,
                    HasCommission = investor.HasCommission,
                };

                _work.Investor.Add(investorObj);

                bool isSaved = _work.Save() > 0;

                if (isSaved)
                {
                    return(Json(true));
                }
            }
            return(Json(false));
        }
Exemple #7
0
        public IEnumerable <SimulationState> Evaluate(
            IStrategy strategy,
            Investor investor,
            DateTime?endDate     = null,
            ProgressBar progress = null)
        {
            var state     = new SimulationState();
            var remaining = _dataCache.Count - _dataCache.BacktestingIndex;

            using var childProgress = ProgressBarProvider.Create(progress, remaining, $"Evaluating: {strategy.StrategyType.GetDescription()}");
            foreach (var data in _dataCache.TakeFrom(Configuration.BacktestingDate, endDate))
            {
                Optimise(strategy);
                var shouldBuy = _simulationCache.GetOrCreate((strategy, data.Date), () => ShouldBuy(strategy, data));

                state = state.UpdateState(data, shouldBuy);
                state.AddFunds(investor.DailyFunds);
                state.ExecuteOrders();

                if (state.ShouldBuy)
                {
                    var funds = strategy.GetStake(data.Date, state.TotalFunds);
                    state.AddBuyOrder(investor.OrderBrokerage, investor.OrderDelayDays, funds);
                }

                childProgress?.Tick();
                yield return(state);
            }
        }
 public async Task Put([FromBody] Investor investor)
 {
     using (var dataAccess = new MasterSideLetterDataAccess(_connectionStrings.MasterSideLetterDb))
     {
         await dataAccess.UpdateInvestorAsync(investor);
     }
 }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,Email,Phone,Description,Address,Zip,CityId,Site")] Investor investor)
        {
            if (id != investor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(investor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvestorExists(investor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "Id", "PrettyName", investor.CityId);
            return(View(investor));
        }
 public async Task <int> Post([FromBody] Investor investor)
 {
     using (var dataAccess = new MasterSideLetterDataAccess(_connectionStrings.MasterSideLetterDb))
     {
         return(await dataAccess.CreateInvestorAsync(investor));
     }
 }
Exemple #11
0
        private static void AddFundAndFirmType(InvestmentActivity accession, InvestorHashTableSet investors)
        {
            if (string.IsNullOrEmpty(accession.ActivistInvestorName))
            {
                return;
            }

            var transformed = accession.ActivistInvestorName.Replace(" ", "").ToLower();

            Investor possibleMatch = null;

            if (investors.FirmNameAsKey.TryGetValue(transformed, out var firmNameMatch))
            {
                possibleMatch = firmNameMatch;
            }
            else if (investors.FundNameAsKey.TryGetValue(transformed, out var fundNameMatch))
            {
                possibleMatch = fundNameMatch;
            }

            if (possibleMatch != null)
            {
                accession.ActivistInvestorId       = possibleMatch.Id.Substring(2); //CLEA 2.xxx system
                accession.ActivistInvestorFundType = possibleMatch.FundType;
                accession.ActivistInvestorFirmType = possibleMatch.FirmType;

                return;
            }
        }
Exemple #12
0
        public async Task BuyStocks()
        {
            const int initialValueOfStocks = 100;
            const int amountToInvest       = 42;

            var startingInvestorDetails = new Investor
            {
                PartitionKey         = "IndividualInvestor",
                RowKey               = Guid.NewGuid().ToString(),
                CurrentValueOfStocks = initialValueOfStocks,
                CurrentValueOfBonds  = 100,
                TargetPercentageAllocationToStocks = 75,
                TargetPercentageAllocationToBonds  = 25
            };

            await CreateTestInvestorInTableStorage(startingInvestorDetails);
            await InvokeAddToPortfolioFunction(startingInvestorDetails.RowKey, amountToInvest);

            // Wait for a while
            await Task.Delay(TimeSpan.FromMinutes(2));

            var resultingInvestor = await GetInvestor(startingInvestorDetails.RowKey);

            Assert.Equal(initialValueOfStocks + amountToInvest, resultingInvestor.CurrentValueOfStocks);
        }
Exemple #13
0
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            Investor = navigationContext.Parameters["Investor"] as Investor;
            if (Investor == null)
            {
                TabTitle            = "unbekannt";
                Investor            = new Investor();
                EMailAccounts       = new ObservableCollection <EMailAccount>(Investor.EMailAccounts);
                TaxInformation      = new ObservableCollection <TaxInformation>(Investor.TaxInformations);
                InvestorToDo        = new ObservableCollection <InvestorToDo>();
                Investor.CurrencyId = ComboboxLists.GetEuroCurrency().Id;
                Investor.Currency   = ComboboxLists.GetEuroCurrency();
            }
            else
            {
                TabTitle = Investor.InvestorHqTrustAccount;
                if (string.IsNullOrEmpty(TabTitle))
                {
                    TabTitle = Investor.IName.LastName;
                }

                Investor       = investorAccess.GetInvestorDetailsById(Investor.Id);
                EMailAccounts  = new ObservableCollection <EMailAccount>(Investor.EMailAccounts);
                TaxInformation = new ObservableCollection <TaxInformation>(Investor.TaxInformations);
                InvestorToDo   = new ObservableCollection <InvestorToDo>(investorAccess.GetToDosForInvestor(Investor.Id));
                if (Investor.Commitments.Count == 0)
                {
                    CanDeleteInvestor = true;
                }

                CreatePreviewAddress();
            }
            accountListToken = eventAggregator.GetEvent <AccountCollectionEvent>().Subscribe(OnAccountListChanged);
        }
Exemple #14
0
        private void CreateDefaultInvestors()
        {
            Investor newInvestor = new Investor();

            newInvestor.Name = "Kevin Brown";
            newInvestor.TotalCashInvested = 10000;
            newInvestor.AdditionalAmount  = 10000;

            Investor newInvestor2 = new Investor();

            newInvestor2.Name = "Patrick Schmidt";
            newInvestor2.TotalCashInvested = 15000;
            newInvestor2.AdditionalAmount  = 10000;

            Investor newInvestor3 = new Investor();

            newInvestor3.Name = "Ben and Bri Sutton";
            newInvestor3.TotalCashInvested = 30000;
            newInvestor3.AdditionalAmount  = 10000;

            Investor newInvestor4 = new Investor();

            newInvestor4.Name = "Jordan Flatt";
            newInvestor4.TotalCashInvested = 10000;
            newInvestor4.AdditionalAmount  = 10000;

            mNewInvestors.Add(newInvestor);
            mNewInvestors.Add(newInvestor2);
            mNewInvestors.Add(newInvestor3);
            mNewInvestors.Add(newInvestor4);
        }
        private void OnErrorSelected()
        {
            if (SelectedError == null)
            {
                return;
            }

            // if PeFundId <>0 start PeFundDetail
            // if InvestorId <>0 start InvestorDetail

            if (SelectedError.InvestorId != 0)
            {
                Investor             investor   = investorAccess.GetInvestorById(SelectedError.InvestorId);
                NavigationParameters parameters = new NavigationParameters();
                parameters.Add("Investor", investor);
                regionManager.RequestNavigate(RegionNames.TabControlRegion, ViewNames.InvestorDetails, parameters);
            }
            if (SelectedError.PeFundId != 0)
            {
                PeFund fund = PefundAccess.GetPeFundById(SelectedError.PeFundId);
                NavigationParameters parameters = new NavigationParameters();
                parameters.Add("Fund", fund);
                regionManager.RequestNavigate(RegionNames.TabControlRegion, ViewNames.PeFundDetail, parameters);
            }
        }
Exemple #16
0
 public Investment(Investor investor, Venture venture, Amount amount)
 {
     this.investor = investor;
     this.venture = venture;
     this.Value = amount;
     this.venture = venture;
 }
        public void UpdateInvestmentAmount()
        {
            String selectedPropertyName = mMainWindow.CurrentPropertySelected.Text.Replace("Current Property: ", "");
            String selectedOwnerName    = mMainWindow.CurrentOwnerSelected.Text.Replace("Current Owner: ", "");

            InvestmentProperty selectedProperty = InvestmentProperty.GetSelectedInvestment(mMainWindow, mNewProperties);
            Investor           investor         = InvestmentProperty.GetSelectedInvestor(mMainWindow, selectedProperty);
            Double             percentOwnership = investor.Percentages.First().Value;


            if (selectedOwnerName != "" && !selectedPropertyName.Contains("Current Property:"))
            {
                percentOwnership = investor.Percentages.First(p => p.Key.Equals(selectedPropertyName)).Value;
            }

            Double orginalAmountInvested = selectedProperty.TotalCashInvested * percentOwnership;

            mMainWindow.OrginalInvestment.Text = "Orginal Amount Investmented: $" + orginalAmountInvested;


            Double rent               = selectedProperty.Rent;
            Double MonthlyPMI         = selectedProperty.Mortgage.PMI / 12;
            Double MonthlyPropertyTax = selectedProperty.Mortgage.PropertyTax / 12;


            Double equityNow = selectedProperty.TotalCashInvested;

            Double remainingPrinciple = selectedProperty.Price - equityNow;
            Double MortgagePayment    = InvestmentProperty.GetMonthlyPayment(selectedProperty, 0, remainingPrinciple);
            Double MortgageTotal      = MortgagePayment + MonthlyPMI + MonthlyPropertyTax;

            mMainWindow.CurrentMortgage.Text = "Current Mortgage: $" + MortgageTotal;
            mMainWindow.CurrentRent.Text     = "Rent: $" + selectedProperty.Rent;
            mMainWindow.PurchasePrice.Text   = "Purchase Price: $" + selectedProperty.Price;
        }
Exemple #18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Poster,Name,budget")] Investor investor)
        {
            if (id != investor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(investor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvestorExists(investor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(investor));
        }
Exemple #19
0
        public BindingSource GetList(Investor anInvestor)
        {
            InvestmentDataHelper DH = new InvestmentDataHelper();
            BindingSource        BS = new BindingSource();
            Hashtable            HT = new Hashtable();

            List <Investment> myList = DH.SelectByInvestorID(anInvestor.ID);

            try
            {
                foreach (var item in myList)
                {
                    if (item.State == EntityState.Enabled)
                    {
                        HT.Add(item.ID, item.Name);
                    }
                }
                HT.Add(-1, "Select Investment");
            }
            catch (NullReferenceException ex)
            {
                throw ex;
            }


            BS.DataSource = HT;
            return(BS);
        }
Exemple #20
0
        public void Test_RBC_Investor1_Get_Notification_3times_Either_Raise_Or_Drop_Price_MeetAroundTargetPrice()
        {
            IStock rbc = new RBC("RBC", 100.00);

            // request a specefic trigger once price dropped for exact target price
            ITradeTrigger investor1Trigger = new TradeTrigger()
            {
                NotificationType        = ReceiveNotificationType.Unlimited,
                TargetPrice             = 120.10,
                Sensitivity             = StockSensitivityType.MeetAroundTargetPrice,
                FluctuationsRate        = 0.2,
                TradeTriggerType        = TradeTriggerType.SellingStock,
                StockPriceDirectionType = StockPriceDirectionType.EitherWay
            };

            IInvestor investor1 = new Investor("investor1", investor1Trigger);

            rbc.Attach(investor1);

            // Stock price getting change by users

            rbc.Price = 120.00;
            rbc.Price = 121.20;
            rbc.Price = 119.10;
            rbc.Price = 120.19;
            rbc.Price = 120.08;

            List <INotification> alerts = rbc.NotificationHistory.Where(h => h.Investor == investor1.InvestorName && h.TradeTriggerType == investor1Trigger.TradeTriggerType).ToList();

            Assert.IsNotNull(alerts);
            Assert.IsTrue(alerts.Count == 1);
            Assert.AreEqual(alerts.FirstOrDefault().Counter, 3);
            Assert.AreEqual(alerts.FirstOrDefault().TradeTriggerType, TradeTriggerType.SellingStock);
            Assert.AreNotEqual(alerts.FirstOrDefault().TradeTriggerType, TradeTriggerType.BuyingStock);
        }
Exemple #21
0
        public void InsertInvestor(Investor investor)
        {
            //
            // UpdateClientAdvisor has updated investor.ClientAdvisor to a new clientadvisor
            //
            if (investor.ClientIsOwnAdvisor == true)
            {
                UpdateClientAdvisor(investor);
            }
            Investor newInvestor = investor.Copy(investor);

            newInvestor.BankAccounts       = new List <BankAccount>();
            newInvestor.DocumentAndLetters = new List <DocumentAndLetter>();
            newInvestor.TaxInformations    = new List <TaxInformation>();
            newInvestor.EMailAccounts      = new List <EMailAccount>();
            newInvestor.Currency           = new Currency();

            using (HqTrustData dbContext = new HqTrustData())
            {
                dbContext.Investors.Add(newInvestor);
                try
                {
                    dbContext.SaveChanges();
                    investor.Id = newInvestor.Id;
                }
                catch (Exception ex)
                {
                    throw new Exception($"Fehler beim Einfügen eines neuen Investors: {ex.InnerException.Message}");
                }
            }
            UpdateBankAccountsForInvestor(investor);
            UpdateDocumentAndLettersForInvestor(investor);
            UpdateTaxInformationsForInvestor(investor);
            UpdateEMailAccountsForInvestor(investor);
        }
        public async Task get_async_using_mail_returns_null_if_related_investor_does_not_exist()
        {
            //Given
            var user     = GetDefaultUser();
            var investor = new Investor(user);

            var userRepositoryMock = new Mock <IUserRepository>();

            userRepositoryMock.Setup(x => x.GetAsync(user.Email))
            .Returns(Task.FromResult(user));

            var companyRepositoryMock = new Mock <ICompanyRepository>();

            var mapperMock = new Mock <IMapper>();

            var investorRepositoryMock = new Mock <IInvestorRepository>();

            investorRepositoryMock.Setup(x => x.GetAsync(user.Id))
            .Returns(Task.FromResult((Investor)null));

            var investorService = new InvestorService(userRepositoryMock.Object,
                                                      investorRepositoryMock.Object, companyRepositoryMock.Object,
                                                      mapperMock.Object);

            //When
            var returnedInvestorDto = await investorService.GetAsync(user.Email);

            //Then
            userRepositoryMock.Verify(x => x.GetAsync(user.Email), Times.Once);
            investorRepositoryMock.Verify(x => x.GetAsync(user.Id), Times.Once);
            returnedInvestorDto.Should().BeNull();
        }
        public async Task trying_to_register_investor_related_with_user_id_that_is_in_use_exception_is_thrown()
        {
            //Given
            var user     = GetDefaultUser();
            var investor = new Investor(user);

            var userRepositoryMock = new Mock <IUserRepository>();

            userRepositoryMock.Setup(x => x.GetAsync(user.Id))
            .Returns(Task.FromResult(user));

            var investorRepositoryMock = new Mock <IInvestorRepository>();

            investorRepositoryMock.Setup(x => x.GetAsync(investor.UserId))
            .Returns(Task.FromResult(investor));


            var companyRepositoryMock = new Mock <ICompanyRepository>();

            var mapperMock = new Mock <IMapper>();

            var investorService = new InvestorService(userRepositoryMock.Object,
                                                      investorRepositoryMock.Object, companyRepositoryMock.Object,
                                                      mapperMock.Object);

            //When
            Task act() => investorService.RegisterAsync(investor.UserId);

            //Then
            await Assert.ThrowsAsync <InvestorExistsSerExc>(act);
        }
        public async Task register_async_should_invoke_add_async_on_repository()
        {
            //Given
            var user     = GetDefaultUser();
            var investor = new Investor(user);

            var userRepositoryMock = new Mock <IUserRepository>();

            userRepositoryMock.Setup(x => x.GetAsync(user.Id))
            .Returns(Task.FromResult(user));

            var investorRepositoryMock = new Mock <IInvestorRepository>();

            investorRepositoryMock.Setup(x => x.GetAsync(investor.UserId))
            .Returns(Task.FromResult((Investor)null));

            var companyRepositoryMock = new Mock <ICompanyRepository>();

            var mapperMock = new Mock <IMapper>();

            var investorService = new InvestorService(userRepositoryMock.Object,
                                                      investorRepositoryMock.Object, companyRepositoryMock.Object,
                                                      mapperMock.Object);

            //When
            await investorService.RegisterAsync(investor.UserId);

            //Then
            investorRepositoryMock.Verify(x => x.AddAsync(It.IsAny <Investor>()), Times.Once);
        }
Exemple #25
0
        public ActionResult DeleteConfirmed(int id)
        {
            Investor investor = db.Investors.Find(id);

            db.Investors.Remove(investor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #26
0
        public static void Observer()
        {
            IInvestor appleInv = new Investor("Apple");
            Subject   ibm      = new Ibm("Shares", 123.45);

            ibm.Attach(appleInv);
            ibm.Price = 234.54;
        }
        private IList <DataPoint> CreateDefaultCashOut(double years, bool rentChk)
        {
            IList <DataPoint> dPoints = new List <DataPoint>();
            String            selectedPropertyName = mMainWindow.CurrentPropertySelected.Text.Replace("Current Property: ", "");
            String            selectedOwnerName    = mMainWindow.CurrentOwnerSelected.Text.Replace("Current Owner: ", "");

            InvestmentProperty selectedProperty = InvestmentProperty.GetSelectedInvestment(mMainWindow, mNewProperties);
            Investor           investor         = InvestmentProperty.GetSelectedInvestor(mMainWindow, selectedProperty);
            Double             percentOwnership = investor.Percentages.First().Value;

            if (selectedOwnerName != "" && !selectedPropertyName.Contains("Current Property:"))
            {
                percentOwnership = investor.Percentages.First(p => p.Key.Equals(selectedPropertyName)).Value;
            }

            Double rent = selectedProperty.Rent;

            //Only Interest for fixed period plus equity
            Double MonthlyPMI         = selectedProperty.Mortgage.PMI / 12;
            Double MonthlyPropertyTax = selectedProperty.Mortgage.PropertyTax / 12;

            Double profit           = 0;
            Double equityNow        = selectedProperty.TotalCashInvested;
            Double allInvestorExtra = InvestmentProperty.GetInvestorExtraMonthly(selectedProperty);

            for (var i = 0; i < years; i++)
            {
                if ((equityNow / selectedProperty.Price) >= .20)
                {
                    MonthlyPMI = 0;
                }

                Double remainingPrinciple = selectedProperty.Price - equityNow - allInvestorExtra;
                Double MortgagePayment    = InvestmentProperty.GetMonthlyPayment(selectedProperty, i, remainingPrinciple);
                Double MortgageTotal      = MortgagePayment + MonthlyPMI + MonthlyPropertyTax;
                equityNow += MortgagePayment - (selectedProperty.Mortgage.InterestRate / 100 * remainingPrinciple / 12);
                Double investorCashOutEquity = InvestmentProperty.GetInvestorCashOutEquity(selectedProperty, investor, i);

                if (MortgageTotal >= 0)
                {
                    profit += (rent - MortgageTotal) * percentOwnership;
                }

                else
                {
                    profit += rent * percentOwnership;
                }

                Double cashOut = Math.Floor((profit + investorCashOutEquity));

                if (i % 12 == 0)
                {
                    dPoints.Add(new DataPoint(i, cashOut));
                }
            }

            return(dPoints);
        }
Exemple #28
0
    public static void Run()
    {
        var ibm      = new IBM("Microsoft", 100);
        var investor = new Investor("Igor");

        ibm.Attach(investor);
        ibm.Price = 300;
        ibm.Price = 200;
    }
Exemple #29
0
            public static Investor Make_Investor(string name)
            {
                Investor ret = new Investor {
                };

                ret.rec = new List <Rec> {
                }; ret.name = name;
                return(ret);
            }
 public async Task <int> Post([FromBody] Investor investor)
 {
     //save the investor
     using (var investorDataAccess = new InvestorDataAccess(_options.Value.Database))
     {
         return(await investorDataAccess.SaveAsync(investor));
     }
     //TODO : save the investor to the event
 }
        public static Investor Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = Testing.TestFunctionRoute + "/getinvestor/{investorId}")] HttpRequest req,
            [Table("Portfolio", InvestorType.Individual, "{investorId}")] Investor investor,
            ILogger log)
        {
            Testing.AssertInTestEnvironment(log);

            return(investor);
        }
Exemple #32
0
        public ActionResult Create(Investor investor)
        {
            if (ModelState.IsValid)
            {
                db.Investors.Add(investor);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(investor);
        }
 public ActionResult Create(Investor investor)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Investors.Add(investor);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Unable to save entity");
     }
     return View(investor);
 }
  public static void Main( string[] args )
  {
    // Create investors
    Investor s = new Investor( "Sorros" );
    Investor b = new Investor( "Berkshire" );

    // Create IBM stock and attach investors
    IBM ibm = new IBM( "IBM", 120.00 );
    ibm.Attach( s );
    ibm.Attach( b );

    // Change price, which notifies investors
    ibm.Price = 120.10;
    ibm.Price = 121.00;
    ibm.Price = 120.50;
    ibm.Price = 120.75;
  }
 public void Detach( Investor investor )
 {
   investors.Remove( investor );
 }
Exemple #36
0
 public Investment(Investor investor, Amount amount)
     : this(investor, null, amount)
 {
 }
 // Methods
 public void Attach( Investor investor )
 {
   investors.Add( investor );
 }
Exemple #38
0
 public virtual bool HasInvestor(Investor investor)
 {
     return this.investor.Equals(investor);
 }
Exemple #39
0
 public ActionResult Edit(Investor investor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(investor).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(investor);
 }