Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Naziv")] Market market)
        {
            if (ModelState.IsValid)
            {
                _context.Add(market);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(market));
        }
        public async Task <IActionResult> Create([Bind("Id,ProizvodjacId,Tip,TrgovinaId,PredajaOglasa,Cijena,Dostupnost,Kontakt")] Availabilities availabilities)
        {
            if (ModelState.IsValid)
            {
                _context.Add(availabilities);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProizvodjacId"] = new SelectList(_context.Producer, "Id", "Naziv", availabilities.ProizvodjacId);
            ViewData["TrgovinaId"]    = new SelectList(_context.Market, "Id", "Naziv", availabilities.TrgovinaId);
            return(View(availabilities));
        }