public Fund() { gu1 = new Stock1(); gu2 = new Stock2(); gu3 = new Stock3(); nd1 = new NationDebt1(); rt1 = new Realty1(); }
public async Task <IActionResult> Create([Bind("ID,Open,Close,High,Low,Type")] Stock2 stock2) { if (ModelState.IsValid) { _context.Add(stock2); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(stock2)); }
static void Main(string[] args) { // 客服端买股票 股民 Stock1 s1 = new Stock1(10); Stock2 s2 = new Stock2(20); Stock3 s3 = new Stock3(40); // 模拟 买 基金 Fund sFund = new Fund(); sFund.Buy(); sFund.Sell(); //不需要 对 股票进行炒作, 只需要 炒作 基金, 由基金 去操作股票; //中介者 模式 Facade facade = new Facade(); // 外观模式 会把所有子系统 集合在一起, 然后 封装它们的方法, 外部 只要调用就好了。 facade.MethodA(); facade.MethodB(); }