public async Task <IHttpActionResult> PutKorisnik(int id, Korisnik korisnik) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != korisnik.KorisnikId) { return(BadRequest()); } db.Entry(korisnik).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KorisnikExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> Create([Bind(Include = "KorisnikId,Ime,Prezime,Username")] Korisnik korisnik) { if (ModelState.IsValid) { db.Korisnici.Add(korisnik); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(korisnik)); }