public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Address,Udobstvo,Rating")] Kino kino)
        {
            if (id != kino.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kino);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KinoExists(kino.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(kino));
        }
Exemple #2
0
 public ActionResult Kino(Kino kinoModel)
 {
     using (KinoContext context = new KinoContext())
     {
         context.KinoComments.Add(kinoModel);
         context.SaveChanges();
     }
     return(View("Kino", new Kino()));
 }
        public async Task <IActionResult> Create([Bind("ID,Title,Address,Udobstvo,Rating")] Kino kino)
        {
            if (ModelState.IsValid)
            {
                _context.Add(kino);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(kino));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,Naziv,Grad")] Kino kino)
        {
            if (ModelState.IsValid)
            {
                _context.Add(kino);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(kino));
        }
Exemple #5
0
        public ActionResult Kino(int id = 0)
        {
            Kino kinoModel = new Kino();

            return(View(kinoModel));
        }
Exemple #6
0
 /// <summary>
 /// Metoda wczytująca z pliku obiekt Kino
 /// </summary>
 public void Wczytaj()
 {
     kino = ZapisOdczyt <Kino> .Deserializacja(path);
 }