Ejemplo n.º 1
0
        static void main()
        {
            DrinkContext db       = new DrinkContext();
            CoffeeStore  charleys = new CoffeeStore()
            {
                Eircode = "T12GH46", City = City.Dublin, OpeningTime = OpeningHour.AM0700, ClosingTime = ClosingHour.PM1800, Location = "dublin fair city", StoreName = "charleys", hasWifi = true
            };
            List <Review> reviews = new List <Review>();

            reviews.Add(new Review()
            {
                CustomerName = "Stevo", CustomerEmail = "*****@*****.**", Eircode = charleys.Eircode, Comment = "It was great", Rating = 4
            });
            reviews.Add(new Review()
            {
                CustomerName = "john", CustomerEmail = "*****@*****.**", Eircode = charleys.Eircode, Comment = "It was great", Rating = 3
            });
            reviews.Add(new Review()
            {
                CustomerName = "pete", CustomerEmail = "*****@*****.**", Eircode = charleys.Eircode, Comment = "It wasn't great", Rating = 2
            });



            //my local connection string
            //Data Source=.\SQLEXPRESS;Initial Catalog=newDb;Integrated Security=SSPI;AttachDBFilename=C:\martin\data\coffeeDb.mdf
        }
Ejemplo n.º 2
0
        static void main()
        {
            DrinkContext db = new DrinkContext();
            CoffeeStore charleys = new CoffeeStore() { Eircode = "T12GH46", City = City.Dublin, OpeningTime = OpeningHour.AM0700, ClosingTime = ClosingHour.PM1800, Location = "dublin fair city", StoreName = "charleys", hasWifi = true };
            List<Review> reviews = new List<Review>();
            reviews.Add(new Review() { CustomerName = "Stevo", CustomerEmail = "*****@*****.**", Eircode = charleys.Eircode, Comment = "It was great", Rating = 4 });
            reviews.Add(new Review() { CustomerName = "john", CustomerEmail = "*****@*****.**", Eircode = charleys.Eircode, Comment = "It was great", Rating = 3 });
            reviews.Add(new Review() { CustomerName = "pete", CustomerEmail = "*****@*****.**", Eircode = charleys.Eircode, Comment = "It wasn't great", Rating = 2 });

            //my local connection string
            //Data Source=.\SQLEXPRESS;Initial Catalog=newDb;Integrated Security=SSPI;AttachDBFilename=C:\martin\data\coffeeDb.mdf
        }
Ejemplo n.º 3
0
 public void AddReview(Review review)
 {
     using (DrinkContext db = new DrinkContext())
     {
         try
         {
             db.Reviews.Add(review);
             db.SaveChanges();
         }
         catch (Exception e)
         { Console.WriteLine(e.ToString()); }
     }
 }
Ejemplo n.º 4
0
 public void AddDrink(Drink drink)
 {
     using (DrinkContext db = new DrinkContext())
     {
         try
         {
             db.Drinks.Add(drink);
             db.SaveChanges();
         }
         catch (Exception e)
         { Console.WriteLine(e.ToString()); }
     }
 }
Ejemplo n.º 5
0
 public void AddStore(CoffeeStore cs)
 {
     using (DrinkContext db = new DrinkContext())
     {
         try
         {
             db.CoffeeStores.Add(cs);
             db.SaveChanges();
         }
         catch (Exception e)
         { Console.WriteLine(e.ToString()); }
     }
 }
Ejemplo n.º 6
0
 public void AddStore(CoffeeStore cs)
 {
     using (DrinkContext db = new DrinkContext())
     {
         try
         {
             db.CoffeeStores.Add(cs);
             db.SaveChanges();
         }
         catch (Exception e)
         { Console.WriteLine(e.ToString()); }
     }
 }
Ejemplo n.º 7
0
 public void AddReview(Review review)
 {
     using (DrinkContext db = new DrinkContext())
     {
         try
         {
             db.Reviews.Add(review);
             db.SaveChanges();
         }
         catch (Exception e)
         { Console.WriteLine(e.ToString()); }
     }
 }
Ejemplo n.º 8
0
 public void AddDrink(Drink drink)
 {
     using (DrinkContext db = new DrinkContext())
     {
         try
         {
             db.Drinks.Add(drink);
             db.SaveChanges();
         }
         catch (Exception e)
         { Console.WriteLine(e.ToString()); }
     }
 }