コード例 #1
0
ファイル: PortfolioBusiness.cs プロジェクト: mohnuris/Alpha
        public DomainObjects.Portfolio.Portfolio Update(string email, int portfolioId, decimal price, string name, string description)
        {
            var user      = UserBusiness.GetValidUser(email);
            var portfolio = GetValidByOwner(user.Id, portfolioId);

            if (portfolio == null)
            {
                throw new ArgumentException("Invalid portfolio.");
            }

            portfolio.Detail = PortfolioDetailBusiness.Create(portfolioId, price, name, description, true);
            return(portfolio);
        }
コード例 #2
0
ファイル: PortfolioBusiness.cs プロジェクト: mohnuris/Alpha
        public void Disable(string email, int portfolioId)
        {
            var user      = UserBusiness.GetValidUser(email);
            var portfolio = GetValidByOwner(user.Id, portfolioId);

            if (portfolio == null)
            {
                throw new ArgumentException("Invalid portfolio.");
            }

            if (!List(portfolio.AdvisorId).Any(c => c.Id != portfolio.Id))
            {
                throw new ArgumentException("Unique advisor's portfolio cannot be disabled.");
            }

            PortfolioDetailBusiness.Create(portfolioId, portfolio.Detail.Price, portfolio.Detail.Name, portfolio.Detail.Description, false);
        }