示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("MokejimoKorteleId,Numeris,Savininkas,KlientasId")] MokejimoKortele mokejimoKortele)
        {
            if (id != mokejimoKortele.MokejimoKorteleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mokejimoKortele);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MokejimoKorteleExists(mokejimoKortele.MokejimoKorteleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KlientasId"] = new SelectList(_context.Klientas, "KlientasId", "KlientasId", mokejimoKortele.KlientasId);
            return(View(mokejimoKortele));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("MokejimoKorteleId,Numeris,Savininkas,KlientasId")] MokejimoKortele mokejimoKortele)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mokejimoKortele);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KlientasId"] = new SelectList(_context.Klientas, "KlientasId", "KlientasId", mokejimoKortele.KlientasId);
            return(View(mokejimoKortele));
        }