public async Task <IHttpActionResult> PutPrintanje(int id, Printanje printanje) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != printanje.PrintanjeId) { return(BadRequest()); } db.Entry(printanje).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrintanjeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { Printanje printanje = db.Printanje.Find(id); db.Printanje.Remove(printanje); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> GetPrintanje(int id) { Printanje printanje = await db.Printanje.FindAsync(id); if (printanje == null) { return(NotFound()); } return(Ok(printanje)); }
public ActionResult Edit([Bind(Include = "PrintanjeId,datumNarudzbe,trenutniStatus,kolicina,hitnaNarudzba,RadnikId,RacunId,format,uvez,dokument,uBoji")] Printanje printanje) { if (ModelState.IsValid) { db.Entry(printanje).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RacunId = new SelectList(db.Racun, "RacunId", "RacunId", printanje.RacunId); ViewBag.RadnikId = new SelectList(db.Radnik, "RadnikId", "ime", printanje.RadnikId); return(View(printanje)); }
public async Task <IHttpActionResult> PostPrintanje(Printanje printanje) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Printanje.Add(printanje); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = printanje.PrintanjeId }, printanje)); }
// GET: Printanjes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Printanje printanje = db.Printanje.Find(id); if (printanje == null) { return(HttpNotFound()); } return(View(printanje)); }
public async Task <IHttpActionResult> DeletePrintanje(int id) { Printanje printanje = await db.Printanje.FindAsync(id); if (printanje == null) { return(NotFound()); } db.Printanje.Remove(printanje); await db.SaveChangesAsync(); return(Ok(printanje)); }
// GET: Printanjes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Printanje printanje = db.Printanje.Find(id); if (printanje == null) { return(HttpNotFound()); } ViewBag.RacunId = new SelectList(db.Racun, "RacunId", "RacunId", printanje.RacunId); ViewBag.RadnikId = new SelectList(db.Radnik, "RadnikId", "ime", printanje.RadnikId); return(View(printanje)); }