示例#1
0
        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));
        }
示例#2
0
        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));
        }