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()); }
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()); }
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(); }
private void btnOrder_Click(object sender, EventArgs e) { SelectedCar.Ordered = true; MessageBox.Show("You are succesfully ordered this Car"); UpdateDatagrid(); db.SaveChanges(); }
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(); }