public IActionResult Add(Marka marka) { var result = _markaService.Add(marka); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Message)); }
public ActionResult Marka(string name, string detay) { /*var tablo =(from a in )*/ Marka marka = new Marka(); marka.MarkaAdi = name; marka.MarkaAciklama = detay; bool control = _markaService.Add(marka); if (control) { return(Json("ok", JsonRequestBehavior.AllowGet)); } return(View(_markaService.GetAll())); }
private void barBtnUrunEkle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { UrunEkleFormModel model = new UrunEkleFormModel() { Urun = new Urun(), Marka = new Marka(), }; try { model.Marka.MarkaAdi = txtMarkaAdi.Text; model.Marka.MarkaId = Convert.ToInt16(txtMarkaId.Text); _markaService.Add(model.Marka); MessageBox.Show("Marka Adi " + txtMarkaAdi.Text); } catch (Exception exception) { MessageBox.Show(exception.Message); } try { model.Urun.UrunAdi = txtUrunIsmi.Text; model.Urun.MarkaId = model.Marka.MarkaId; model.Urun.StokDurum = 1; model.Urun.UrunAded = Convert.ToInt32(txtUrunAdedi.Text); model.Urun.UrunId = Convert.ToInt32(txtUrunId.Text); _urunService.Add(model.Urun); MessageBox.Show("Ürün Eklendi"); this.Close(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }