public async Task<IActionResult> Edit(int id, [Bind("id,receteNo,ilacKodu")] ReceteIlac receteIlac) { if (id != receteIlac.id) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(receteIlac); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReceteIlacExists(receteIlac.id)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } ViewData["ilacKodu"] = new SelectList(_context.Ilac, "ilacKodu", "ilacKodu", receteIlac.ilacKodu); ViewData["receteNo"] = new SelectList(_context.Recete, "receteNo", "receteNo", receteIlac.receteNo); return View(receteIlac); }
public async Task<IActionResult> Create([Bind("id,receteNo,ilacKodu")] ReceteIlac receteIlac) { if (ModelState.IsValid) { _context.Add(receteIlac); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } ViewData["ilacKodu"] = new SelectList(_context.Ilac, "ilacKodu", "ilacKodu", receteIlac.ilacKodu); ViewData["receteNo"] = new SelectList(_context.Recete, "receteNo", "receteNo", receteIlac.receteNo); return View(receteIlac); }