示例#1
0
 public ActionResult CreateMatrix(RCA mRegister)
 {
     if (ModelState.IsValid)
     {
         return(View("Completed"));
     }
     else
     {
         ViewBag.SelProduct = mRegister.product;
         BindProduct();
         ViewBag.SelCity = mRegister.component;
         if (mRegister.product != null)
         {
             BindComponent(mRegister.product.ID);
         }
         else
         {
             BindComponent(null);
         }
         return(View());
     }
 }
        public static void Run()
        {
            TV            rca       = new RCA();
            RemoteControl remoteRCA = new ConcreteRemote(rca);

            remoteRCA.On();
            remoteRCA.SetChannel(10);
            remoteRCA.Off();

            Console.WriteLine("\nI got a new TV! Time to reprogram the remote ...");
            TV             sony       = new Sony();
            ConcreteRemote sonyRemote = remoteRCA as ConcreteRemote;

            sonyRemote.ProgramToNewTV(sony);

            sonyRemote.On();
            sonyRemote.SetChannel(10);
            sonyRemote.NextChannel();
            sonyRemote.NextChannel();
            sonyRemote.PreviousChannel();
            sonyRemote.Off();
        }