Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
 public void AddReview(Review s)
 {
     _context.Reviews.Add(s);
     _context.SaveChanges();
 }