public async Task <IActionResult> Edit(int id, [Bind("IdPoklon,Naziv,VrstaRobe,Kupljen")] Poklon poklon) { if (id != poklon.IdPoklon) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(poklon); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PoklonExists(poklon.IdPoklon)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["VrstaRobe"] = new SelectList(_context.VrstaRobes, "Id", "Naziv", poklon.VrstaRobe); return(View(poklon)); }
public ActionResult DeleteConfirmed(int id) { Poklon poklon = _db.Pokloni.Find(id); _db.Pokloni.Remove(poklon); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Obrisi(int id) { Poklon poklon = _baza.Pokloni.Find(id); _baza.Pokloni.Remove(poklon); _baza.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Uredi(Poklon poklon) { if (ModelState.IsValid) { _baza.Entry(poklon).State = EntityState.Modified; _baza.SaveChanges(); return(RedirectToAction("Index")); } return(View(poklon)); }
public ActionResult Dodaj(Poklon poklon) { if (ModelState.IsValid) { _baza.Pokloni.Add(poklon); _baza.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create(Poklon poklon) { if (ModelState.IsValid) { _db.Pokloni.Add(poklon); _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(poklon)); }
public async Task <IActionResult> Create([Bind("IdPoklon,Naziv,VrstaRobe,Kupljen")] Poklon poklon) { if (ModelState.IsValid) { _context.Add(poklon); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["VrstaRobe"] = new SelectList(_context.VrstaRobes, "Id", "Naziv", poklon.VrstaRobe); return(View(poklon)); }
/* Initialization */ private void SetupGame() { //1. setup stage SetStageTitle("PMF"); //setBackgroundColor(Color.WhiteSmoke); setBackgroundPicture("backgrounds\\back.jpg"); //none, tile, stretch, center, zoom setPictureLayout("stretch"); //2. add sprites elf = new Person("sprites\\elf.png", (GameOptions.RightEdge - GameOptions.SpriteWidth) / 2, GameOptions.DownEdge - GameOptions.SpriteHeight); santa = new Person("sprites\\santa.png", 0, 0); poklon = new Poklon("sprites\\gift.png", 0, 0); petarda = new Petarda("sprites\\fireCracker.png", 0, 0); //elf.RotationStyle = "AllAround"; //santa.RotationStyle = "LeftRight"; santa.Heigth = GameOptions.SpriteHeight; santa.Width = GameOptions.SpriteWidth; elf.Heigth = GameOptions.SpriteHeight; elf.Width = GameOptions.SpriteWidth; poklon.Heigth = 50; poklon.Width = 50; petarda.Heigth = 50; petarda.Width = 50; Game.AddSprite(elf); Game.AddSprite(santa); Game.AddSprite(poklon); Game.AddSprite(petarda); _poklonEvent += touchPoklon; poklon._lostLife += CheckLife; _gameOver += gameOver; _petardaEvent += touchPetarda; petarda._cekaj += Cekaj; poklon._cekaj += Cekaj; //3. scripts that start //petarda se neće pokrenuti s ostalima jer se pokreće svakih 200 bodova Game.StartScript(SantaFly); Game.StartScript(ElfMove); Game.StartScript(Drop); }
public ActionResult Obrisi(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Poklon poklon = _baza.Pokloni.Find(id); if (poklon == null) { return(HttpNotFound()); } return(View(poklon)); }