public async Task <IActionResult> Edit(int id, [Bind("Id,Fiyat,Adet,ReceteId")] Ilaclar ilaclar) { if (id != ilaclar.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ilaclar); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IlaclarExists(ilaclar.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ReceteId"] = new SelectList(_context.Recete, "Id", "IlacAd", ilaclar.ReceteId); return(View(ilaclar)); }
public async Task <IActionResult> Create([Bind("Id,Fiyat,Adet,ReceteId")] Ilaclar ilaclar) { if (ModelState.IsValid) { _context.Add(ilaclar); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ReceteId"] = new SelectList(_context.Recete, "Id", "IlacAd", ilaclar.ReceteId); return(View(ilaclar)); }