예제 #1
0
 public static void AddCustom(Custom cs)
 {
     using (ProteinDBContext db = new ProteinDBContext())
     {
         db.Custom.Add(cs);
         db.SaveChanges();
     }
 }
예제 #2
0
 public static void Add(Customer customer)
 {
     using (ProteinDBContext db = new ProteinDBContext())
     {
         db.Customer.Add(customer);
         db.SaveChanges();
     }
 }
예제 #3
0
 public static Customer UpdateCustomerInfo(Customer customer)
 {
     using (ProteinDBContext db = new ProteinDBContext())
     {
         var uptated = db.Customer.Find(customer.CustomerID);
         uptated.Name    = customer.Name;
         uptated.Surname = customer.Surname;
         uptated.Phone   = customer.Phone;
         db.SaveChanges();
         return(uptated);
     }
 }
예제 #4
0
        static void Main(string[] args)
        {
            using (ProteinDBContext db = new ProteinDBContext())
            {
                Admin a = new Admin();
                a.UserName = "******";
                a.Password = "******";

                db.Admin.Add(a);

                Category c = new Category();
                c.CategoryName = "Protein Tozu";
                db.Category.Add(c);



                Brand w = new Brand();
                w.BrandName = "Optimum";

                db.Brand.Add(w);


                Product b = new Product()
                {
                    ProductName    = "Optimum Whey",
                    ProductContent = "aaaaa",
                    CategoryID     = 1,
                    Price          = 230,
                    BrandID        = 1,
                    ProductPhoto   = "http://placehold.it/800x300",
                };

                db.Product.Add(b);
                Customer cu = new Customer()
                {
                    Name    = "Hakan Karanfil",
                    Address = "izmir"
                };

                db.Customer.Add(cu);

                db.SaveChanges();
            }
        }