public async Task <IActionResult> Edit(int id, [Bind("Naziv,Kalorije,Proteini,Ugljikohidrati,Masti")] Namirnica namirnica)
        {
            if (id != namirnica.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(namirnica);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NamirnicaExists(namirnica.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(namirnica));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Kategorija")] Obrok obrok)
        {
            if (id != obrok.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(obrok);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ObrokExists(obrok.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(obrok));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv")] Test test)
        {
            if (id != test.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(test);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestExists(test.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(test));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Komentar,Ocjena,RegistrovaniID")] Recenzija recenzija)
        {
            if (id != recenzija.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(recenzija);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RecenzijaExists(recenzija.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RegistrovaniID"] = new SelectList(_context.Registrovani, "ID", "Ime", recenzija.RegistrovaniID);
            return(View(recenzija));
        }
Beispiel #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Opis,Period,Ponavljanje")] Podsjetnik podsjetnik)
        {
            if (id != podsjetnik.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(podsjetnik);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PodsjetnikExists(podsjetnik.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(podsjetnik));
        }
Beispiel #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Period,PreostaleKalorije,RegistrovaniID")] DnevniPlan dnevniPlan)
        {
            if (id != dnevniPlan.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dnevniPlan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DnevniPlanExists(dnevniPlan.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RegistrovaniID"] = new SelectList(_context.Registrovani, "ID", "Ime", dnevniPlan.RegistrovaniID);
            return(View(dnevniPlan));
        }
Beispiel #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,DozvoljeneKalorije")] PlanIshrane planIshrane)
        {
            if (id != planIshrane.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(planIshrane);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlanIshraneExists(planIshrane.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(planIshrane));
        }
Beispiel #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,PitanjeID")] Odgovor odgovor)
        {
            if (id != odgovor.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(odgovor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OdgovorExists(odgovor.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PitanjeID"] = new SelectList(_context.Pitanja, "ID", "Naziv", odgovor.PitanjeID);
            return(View(odgovor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Spol,Ime,DatumRodjenja,Visina,Tezina,Username,Password")] Registrovani registrovani)
        {
            if (id != registrovani.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registrovani);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistrovaniExists(registrovani.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(registrovani));
        }
Beispiel #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,TestID")] Pitanje pitanje)
        {
            if (id != pitanje.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pitanje);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PitanjeExists(pitanje.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TestID"] = new SelectList(_context.Testovi, "ID", "ID", pitanje.TestID);
            return(View(pitanje));
        }