Пример #1
0
        public async Task <IActionResult> UrunEkle([Bind("UrunAd,StokMiktari,UrunResimURL,UrunFiyat,KategoriID, KategoriAdi")] Urun urun)
        {
            if (ModelState.IsValid)
            {
                _context.Add(urun);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(UrunEkle)));
            }
            return(View(urun));
        }
        public async Task <IActionResult> UyeOl([Bind("KullaniciID,KullaniciAdi,KullaniciSifresi,Email,DogumTarihi,Adres")] Kullanici kullanici)
        {
            if (ModelState.IsValid)
            {
                Sepet sepet = new Sepet();
                sepet.SepetID     = kullanici.KullaniciID;
                sepet.KullaniciID = kullanici.KullaniciID;
                kullanici.Sepeti  = sepet;
                _context.Add(sepet);
                _context.Add(kullanici);
                await _context.SaveChangesAsync();

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