示例#1
0
 public static void Initialize(TVContext context)
 {
     if (!context.TVs.Any())
     {
         context.TVs.AddRange(
             new TV
         {
             Name    = "Samsung UE55RU7172 ",
             Company = "Samsung",
             Price   = 1500
         },
             new TV
         {
             Name    = "Sony KD-55XG9505 ",
             Company = "Sony",
             Price   = 1250
         },
             new TV
         {
             Name    = "Vinga S50UHD20B",
             Company = "Vinga",
             Price   = 1400
         }
             );
         context.SaveChanges();
     }
 }
示例#2
0
 public static void Initialize(TVContext context)
 {
     if (!context.TVs.Any())
     {
         context.TVs.AddRange(
             new TV
         {
             Name    = "LG X54T-2019",
             Company = "LG",
             Price   = 1000
         },
             new TV
         {
             Name    = "Samsung UltraTV-v.3",
             Company = "Samsung",
             Price   = 950
         },
             new TV
         {
             Name    = "Sony XD-555",
             Company = "Sony",
             Price   = 660
         }
             );
         context.SaveChanges();
     }
 }
示例#3
0
        /// <summary>
        /// a simple program to test our implementation of TV Remote using State pattern
        /// </summary>
        static void StateTest()
        {
            TVContext context      = new TVContext();
            IState    tvStartState = new TVStartState();
            IState    tvStopState  = new TVStopState();

            context.State = tvStartState;
            context.doAction();

            context.State = tvStopState;
            context.doAction();
        }
 public HomeController(TVContext context)
 {
     db = context;
 }