public async Task <IActionResult> Edit(int id, [Bind("DviratisId,Gamintojas,Tipas,nuomosKaina,DviracioBusenaId,AiksteleId")] Dviratis dviratis)
        {
            if (id != dviratis.DviratisId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dviratis);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DviratisExists(dviratis.DviratisId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AiksteleId"]       = new SelectList(_context.Aikstele, "AiksteleId", "AiksteleId", dviratis.AiksteleId);
            ViewData["DviracioBusenaId"] = new SelectList(_context.Set <DviracioBusena>(), "DviracioBusenaId", "DviracioBusenaId", dviratis.DviracioBusenaId);
            return(View(dviratis));
        }
        public async Task <IActionResult> Create([Bind("DviratisId,Gamintojas,Tipas,nuomosKaina,DviracioBusenaId,AiksteleId")] Dviratis dviratis)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dviratis);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AiksteleId"]       = new SelectList(_context.Aikstele, "AiksteleId", "AiksteleId", dviratis.AiksteleId);
            ViewData["DviracioBusenaId"] = new SelectList(_context.Set <DviracioBusena>(), "DviracioBusenaId", "DviracioBusenaId", dviratis.DviracioBusenaId);
            return(View(dviratis));
        }