示例#1
0
        public IHttpActionResult Post(KvarVM p)
        {
            Kvarovi n = new Kvarovi();

            n.Opis    = p.Opis;
            n.KupacID = p.KupacID;

            ctx.Kvarovi.Add(n);
            ctx.SaveChanges();
            return(Ok());
        }
示例#2
0
        public IHttpActionResult Post(PitanjaVM p)
        {
            Pitanja n = new Pitanja();

            n.Opis    = p.Opis;
            n.KupacID = p.KupacID;

            ctx.Pitanja.Add(n);
            ctx.SaveChanges();
            return(Ok());
        }
示例#3
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string BrandName = txtBrandName.Text;
            Brand  NewBrand  = new Brand()
            {
                Name = BrandName
            };

            db.Brands.Add(NewBrand);
            UpdateDatagrid();
            db.SaveChanges();
        }
示例#4
0
 private void btnOrder_Click(object sender, EventArgs e)
 {
     SelectedCar.Ordered = true;
     MessageBox.Show("You are succesfully ordered this Car");
     UpdateDatagrid();
     db.SaveChanges();
 }
示例#5
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string    Carname     = txtCarName.Text;
            ComboItem Brandname   = cmbBrand.SelectedItem as ComboItem;
            int       year        = (int)cmbYear.SelectedItem;
            string    EnginePower = txtengine.Text;
            string    Fueltype    = txtFuelType.Text;
            bool      order       = chbOrdered.ThreeState;

            Car newcar = new Car()
            {
                Name        = Carname,
                BrandId     = Brandname.Id,
                Year        = year,
                EnginePower = EnginePower,
                Fueltype    = Fueltype,
                Ordered     = order
            };

            if (Carname != null && EnginePower != null && Fueltype != null && Carname != "" && EnginePower != "" && Fueltype != "")
            {
                db.Cars.Add(newcar);
            }
            else if (Carname == null || Carname == "")
            {
                MessageBox.Show("You are not include Car name");
            }
            else if (EnginePower == null || EnginePower == "")
            {
                MessageBox.Show("You are not include Engine Power");
            }

            else if (Fueltype == null || Fueltype == "")
            {
                MessageBox.Show("You are not include Fuel type");
            }
            UpdateDatagrid();
            db.SaveChanges();
        }