Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Printanje printanje = db.Printanje.Find(id);

            db.Printanje.Remove(printanje);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> GetPrintanje(int id)
        {
            Printanje printanje = await db.Printanje.FindAsync(id);

            if (printanje == null)
            {
                return(NotFound());
            }

            return(Ok(printanje));
        }
Ejemplo n.º 4
0
 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));
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        // 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));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        // 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));
        }