public async Task <IActionResult> Edit(int id, [Bind("Id,ArabaId,PersonelId,Tarih,Fiyat")] IlanKoy ilanKoy)
        {
            if (id != ilanKoy.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ilanKoy);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IlanKoyExists(ilanKoy.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArabaId"]    = new SelectList(_context.Arabas, "Id", "Ad", ilanKoy.ArabaId);
            ViewData["PersonelId"] = new SelectList(_context.Personels, "Id", "Id", ilanKoy.PersonelId);
            return(View(ilanKoy));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,EvId,OfisId")] IlanKoy ilanKoy)
        {
            if (id != ilanKoy.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ilanKoy);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IlanKoyExists(ilanKoy.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EvId"]   = new SelectList(_context.Ev, "Id", "EvTipi", ilanKoy.EvId);
            ViewData["OfisId"] = new SelectList(_context.Ofis, "Id", "Name", ilanKoy.OfisId);
            return(View(ilanKoy));
        }
        public async Task <IActionResult> Create([Bind("Id,ArabaId,PersonelId,Tarih,Fiyat")] IlanKoy ilanKoy)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ilanKoy);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArabaId"]    = new SelectList(_context.Arabas, "Id", "Ad", ilanKoy.ArabaId);
            ViewData["PersonelId"] = new SelectList(_context.Personels, "Id", "Id", ilanKoy.PersonelId);
            return(View(ilanKoy));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,EvId,OfisId")] IlanKoy ilanKoy)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ilanKoy);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EvId"]   = new SelectList(_context.Ev, "Id", "EvTipi", ilanKoy.EvId);
            ViewData["OfisId"] = new SelectList(_context.Ofis, "Id", "Name", ilanKoy.OfisId);
            return(View(ilanKoy));
        }