public async Task <IActionResult> Edit(int id, [Bind("Id,PersonelId,ArabaId,KiraciId,KiraFiyati,Sure")] ArabaKira arabaKira) { if (id != arabaKira.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(arabaKira); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArabaKiraExists(arabaKira.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ArabaId"] = new SelectList(_context.Arabas, "Id", "Ad", arabaKira.ArabaId); ViewData["KiraciId"] = new SelectList(_context.Kiracis, "Id", "Ad", arabaKira.KiraciId); ViewData["PersonelId"] = new SelectList(_context.Personels, "Id", "Id", arabaKira.PersonelId); return(View(arabaKira)); }
public async Task <IActionResult> Create([Bind("Id,PersonelId,ArabaId,KiraciId,KiraFiyati,Sure")] ArabaKira arabaKira) { if (ModelState.IsValid) { _context.Add(arabaKira); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArabaId"] = new SelectList(_context.Arabas, "Id", "Ad", arabaKira.ArabaId); ViewData["KiraciId"] = new SelectList(_context.Kiracis, "Id", "Ad", arabaKira.KiraciId); ViewData["PersonelId"] = new SelectList(_context.Personels, "Id", "Id", arabaKira.PersonelId); return(View(arabaKira)); }