public async Task <IActionResult> Create([Bind("Id,EvId,OzellikTipi")] Ozellik ozellik) { if (ModelState.IsValid) { _context.Add(ozellik); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EvId"] = new SelectList(_context.Ev, "Id", "EvTipi", ozellik.EvId); return(View(ozellik)); }
protected void UrunBilgiDoldur(Urun urun) { lbl_urunAd.Text = urun.UrunAdi; lbl_urunTanim.Text = urun.Tanimi; urunIndirim.Text = "%" + urun.Indirim + "<br/>" + "indirim"; IEnumerable <UrunOzellikDeger> urunOzellikDegerList = eticaretDB.UrunOzellikDegers.Where(u => u.UrunID == urun.UrunID); foreach (UrunOzellikDeger uod in urunOzellikDegerList) { TableRow tr = new TableRow(); Label lbl_ozellikAd = new Label(); lbl_ozellikAd.CssClass = "ozellikAd"; Label lbl_ozellikDeger = new Label(); Label lbl_ayrac = new Label(); OzellikDeger ozellikDeger = eticaretDB.OzellikDegers.SingleOrDefault(o => o.OzellikDegerID == uod.OzellikDegerID); string deger = ozellikDeger.Deger; var ID = (from o in eticaretDB.OzellikDegers where (o.OzellikDegerID == ozellikDeger.OzellikDegerID) join a in eticaretDB.AltKategoriOzelliks on o.AltKategoriOzellikID equals a.AltKategoriOzellikID select new { a.OzellikID }).ToList(); int ozellikID = ID[0].OzellikID; Ozellik ozellik = eticaretDB.Ozelliks.SingleOrDefault(o => o.OzellikID == ozellikID); string ad = ozellik.OzellikAdi; lbl_ozellikAd.Text = ad; lbl_ayrac.Text = " : "; lbl_ozellikDeger.Text = deger; TableCell td1 = new TableCell(); td1.Controls.Add(lbl_ozellikAd); TableCell td2 = new TableCell(); td2.Controls.Add(lbl_ayrac); TableCell td3 = new TableCell(); td3.Controls.Add(lbl_ozellikDeger); tr.Controls.Add(td1); tr.Controls.Add(td2); tr.Controls.Add(td3); tbl_urunOzellik.Controls.Add(tr); } OylamaGetir(urun.UrunID); }
public IActionResult Post([FromBody] Ozellik ozellik) { if (ozellik != null) { if (_unitOfWork.OzellikRepository.Insert(ozellik) >= 0) { try { _unitOfWork.Commit(); } catch (Exception) { return(StatusCode(500)); } return(Ok()); } } return(BadRequest()); }