private ProfileForUpdateVm[] FetchDBProfilesByInvestor(string currentInvestor)
        {
            // to be called by controller

            if (currentInvestor == null || currentInvestor == string.Empty)
            {
                return(null);
            }

            InvestorSvc service = new InvestorSvc(_ctx);

            Data.Entities.Investor investor = service.GetByLogin(currentInvestor);

            IQueryable <ProfileForUpdateVm> joinData = _ctx.Position.Where(p => p.PositionAsset.InvestorId == investor.InvestorId && p.Status == "A")
                                                       .Join(_ctx.Profile, p => p.PositionAsset.Profile.ProfileId,
                                                             pr => pr.ProfileId,
                                                             (position, profile) => new ProfileForUpdateVm
            {
                ProfileId      = profile.ProfileId,
                TickerSymbol   = profile.TickerSymbol,
                DividendFreq   = profile.DividendFreq,
                DividendMonths = profile.DividendMonths,
                DividendPayDay = profile.DividendPayDay
            })
                                                       .OrderBy(results => results.TickerSymbol)
                                                       .AsQueryable();

            return(joinData.ToArray());
        }
Example #2
0
        public bool Update(Data.Entities.Investor investorToUpdate)
        {
            int updateCount = 0;

            _ctx.Update(investorToUpdate);
            updateCount = _ctx.SaveChanges();

            return(updateCount == 1
                ? true
                : false);
        }