コード例 #1
0
ファイル: QuotesController.cs プロジェクト: BizzyQuote/BQ2013
        public ActionResult ListByCompany()
        {
            List<Quote> quotes;
            int companyID = 0;
            using (var um = new UserManager())
            {
                // any user tied to a company can only see their company quotes
                var currentUser = um.ByUsername(User.Identity.Name);
                if (currentUser.CompanyID != null)
                {
                    companyID = currentUser.CompanyID.GetValueOrDefault();
                }
            }
            using (var qm = new QuoteManager())
            {
                quotes = qm.ActiveByCompany(companyID).OrderByDescending(q => q.CreatedOn).ToList();
            }

            ViewBag.Quotes = quotes;
            return View("QuoteList");
        }