예제 #1
0
        public async Task <IActionResult> Create([Bind("OcenaID,KomputerID,Ocena")] OcenaModel ocenaModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ocenaModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ocenaModel));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("KomputerID,Model,Producent,Cena,DataProdukcji,KartaGraficzna,Procesor,PlytaGlowna")] KomputerModel komputerModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(komputerModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(komputerModel));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("UzytkownikId,Login,Email,CzyAdmin,Wypozyczone")] UzytkownicyModel uzytkownicyModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(uzytkownicyModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(uzytkownicyModel));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("ZnizkiId,UzytkownikId,Znizka")] ZnizkiModel znizkiModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(znizkiModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(znizkiModel));
        }
예제 #5
0
        public async Task <IActionResult> Create([Bind("RezerwacjaID,KomputerID,UzytkownikID,DataRozpoczecia,DataZakonczenia,DataPrzedluzona")] RezerwacjaModel rezerwacjaModel)
        {
            if (ModelState.IsValid)
            {
                var komputery = await _context.KomputerModel.ToListAsync();

                if (komputery.Any(x => x.KomputerID == rezerwacjaModel.KomputerID))
                {
                    _context.Add(rezerwacjaModel);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    ViewBag.Message = "Podane id komputera nie istnieje";
                }
            }
            return(View(rezerwacjaModel));
        }