public async Task <IActionResult> AddOrEdit([Bind("CijenaArtikla,NazivArtikla,KratkiOpis,DetaljniOpis,URLSlike1,URLMaleSlike1, tipNaziv")] Artikal artikal)
        {
            if (ModelState.IsValid)
            {
                using (var transaction = _context.Database.BeginTransaction())
                {
                    _context.Add(artikal);
                    _context.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT dbo.Artikal ON");
                    _context.SaveChanges();
                    _context.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT dbo.Artikal OFF");

                    transaction.Commit();
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                var errors = ModelState.Select(x => x.Value.Errors)
                             .Where(y => y.Count > 0)
                             .ToList();

                Debug.WriteLine("not valid");
                foreach (object o in errors)
                {
                    Debug.WriteLine(o.ToString());
                }
                Debug.WriteLine("not valid");
            }
            return(View(artikal));
        }
        public async Task <IActionResult> Create([Bind("TekstObavijesti,IdObavijesti")] Obavijest obavijest)
        {
            if (ModelState.IsValid)
            {
                _context.Add(obavijest);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(obavijest));
        }
        public async Task <IActionResult> Create([Bind("DatumVrijemeNarudzbe,IdNarudzbe")] Narudzba narudzba)
        {
            if (ModelState.IsValid)
            {
                _context.Add(narudzba);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(narudzba));
        }
        public async Task <IActionResult> Create([Bind("idTipa,Ime")] Tip tip)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tip);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tip));
        }
        public async Task <IActionResult> Create([Bind("IdKorpe,SlikaKorpe")] Korpa korpa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(korpa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(korpa));
        }
        public async Task <IActionResult> Create([Bind("BatteryLifeRating,DesignRating,PerformanceRating,OverallRating,IdRecenzije")] Recenzija recenzija)
        {
            if (ModelState.IsValid)
            {
                _context.Add(recenzija);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(recenzija));
        }