示例#1
0
 static public void CreateNew(motherboards newGraphicCard)
 {
     using (var db = new StudiaProjektBazyDanychEntities())
     {
         db.motherboards.Add(newGraphicCard);
         db.SaveChanges();
     }
 }
 static public void AddMotherboardToReclamation(motherboards temporaryMotherboard, int amount)
 {
     using (var db = new StudiaProjektBazyDanychEntities())
     {
         LocalOrder.motherboards       = db.motherboards.SingleOrDefault(t => t.id == temporaryMotherboard.id);
         LocalOrder.id_motherboard     = LocalOrder.motherboards.id;
         LocalOrder.motherboard_amount = amount;
     }
 }
 static public void AddMotherboardToOrder(motherboards temporaryMotherboard, int amount)
 {
     LocalOrder.motherboards = new motherboards()
     {
         model            = temporaryMotherboard.model,
         cpu_socket       = temporaryMotherboard.cpu_socket,
         ram_memory_type  = temporaryMotherboard.ram_memory_type,
         ram_memory_slots = temporaryMotherboard.ram_memory_slots,
         price            = temporaryMotherboard.price,
         amount           = amount,
         image_source     = temporaryMotherboard.image_source,
         description      = temporaryMotherboard.description
     };
 }
        private void AddMotherboard()
        {
            motherboards motherboard = new motherboards()
            {
                model            = ModelNameTextBox.Text,
                cpu_socket       = ProcessorSocketTypeTextBox.Text,
                ram_memory_type  = RamMemoryTypeTextBox.Text,
                ram_memory_slots = Int32.Parse(RamMemorySlotsTextBox.Text),
                price            = Int32.Parse(PriceTextBox.Text),
                amount           = 0,
                image_source     = LinkToImageTextBox.Text,
                description      = DescriptionTextBox.Text
            };

            MotherBoardsAcessor.CreateNew(motherboard);
        }