public IHttpActionResult PutNacinDostave(int id, NacinDostave nacinDostave) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nacinDostave.NacinDostaveID) { return(BadRequest()); } db.Entry(nacinDostave).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NacinDostaveExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetNacinDostave(int id) { NacinDostave nacinDostave = db.NacinDostave.Find(id); if (nacinDostave == null) { return(NotFound()); } return(Ok(nacinDostave)); }
public IHttpActionResult PostNacinDostave(NacinDostave nacinDostave) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NacinDostave.Add(nacinDostave); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = nacinDostave.NacinDostaveID }, nacinDostave)); }
public IHttpActionResult DeleteNacinDostave(int id) { NacinDostave nacinDostave = db.NacinDostave.Find(id); if (nacinDostave == null) { return(NotFound()); } db.NacinDostave.Remove(nacinDostave); db.SaveChanges(); return(Ok(nacinDostave)); }