public static void Initialize(ArduinoContext context)
 {
     if (!context.Purchases.Any())
     {
         context.Purchases.AddRange(
             new Purchase
         {
             PurchaseId = "1",
             Date       = DateTime.Today,
             Number     = 2,
             Price      = 90,
             UserId     = "23"
         }
             );
         context.SaveChanges();
     }
     if (!context.Reviews.Any())
     {
         context.Reviews.AddRange(
             new Review
         {
             Text  = "Very good.",
             Date  = DateTime.Today,
             Email = "*****@*****.**"
         },
             new Review
         {
             Text  = "Very very harasho.",
             Date  = DateTime.Today,
             Email = "*****@*****.**"
         },
             new Review
         {
             Text  = "Wow.",
             Date  = DateTime.Today,
             Email = "*****@*****.**"
         }
             );
         context.SaveChanges();
     }
 }
Exemple #2
0
 public ArduinoRepository(ArduinoContext ac)
 {
     _context = ac;
 }