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> Edit([Bind(Include = "KorisnikId,Ime,Prezime,Username")] Korisnik korisnik) { if (ModelState.IsValid) { db.Entry(korisnik).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(korisnik)); }