public async Task <IActionResult> Edit(int id, [Bind("Id,SporSalonAd,IlceId,Iletisim,Adres")] SporSalon sporSalon) { if (id != sporSalon.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sporSalon); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SporSalonExists(sporSalon.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IlceId"] = new SelectList(_context.Ilce, "Id", "Id", sporSalon.IlceId); return(View(sporSalon)); }
public async Task <IActionResult> Create([Bind("Id,SporSalonAd,IlceId,Iletisim,Adres")] SporSalon sporSalon) { if (ModelState.IsValid) { _context.Add(sporSalon); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IlceId"] = new SelectList(_context.Ilce, "Id", "Id", sporSalon.IlceId); return(View(sporSalon)); }