public IHttpActionResult PutKrstTermini(int id, KrstTermini krstTermini) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != krstTermini.Id) { return(BadRequest()); } db.Entry(krstTermini).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!KrstTerminiExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { KrstTermini krstTermini = db.KrstTerminis.Include(k => k.cruise).FirstOrDefault(k => k.Id == id); db.KrstTerminis.Remove(krstTermini); db.SaveChanges(); return(RedirectToAction("Details", "Cruises", new { id = krstTermini.CruiseId })); }
public ActionResult Edit([Bind(Include = "Id,date,VnatresnaKabina,ProzorkaKabina,BalkonskaKabina,CruiseId")] KrstTermini krstTermini) { if (ModelState.IsValid) { db.Entry(krstTermini).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CruiseId = new SelectList(db.Cruises, "Id", "Name", krstTermini.CruiseId); return(RedirectToAction("Details", "Cruises", new { id = krstTermini.CruiseId })); }
public IHttpActionResult GetKrstTermini(int id) { KrstTermini krstTermini = db.KrstTerminis.Find(id); if (krstTermini == null) { return(NotFound()); } return(Ok(krstTermini)); }
public ActionResult Create([Bind(Include = "Id,date,VnatresnaKabina,ProzorkaKabina,BalkonskaKabina,CruiseId")] KrstTermini krstTermini) { if (ModelState.IsValid) { db.KrstTerminis.Add(krstTermini); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CruiseId = new SelectList(db.Cruises, "Id", "Name", krstTermini.CruiseId); return(View(krstTermini)); }
public IHttpActionResult PostKrstTermini(KrstTermini krstTermini) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.KrstTerminis.Add(krstTermini); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = krstTermini.Id }, krstTermini)); }
// GET: KrstTerminis/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KrstTermini krstTermini = db.KrstTerminis.Find(id); if (krstTermini == null) { return(HttpNotFound()); } return(View(krstTermini)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KrstTermini krstTermini = db.KrstTerminis.Include(k => k.cruise).FirstOrDefault(k => k.Id == id); if (krstTermini == null) { return(HttpNotFound()); } return(View(krstTermini)); }
public IHttpActionResult DeleteKrstTermini(int id) { KrstTermini krstTermini = db.KrstTerminis.Find(id); if (krstTermini == null) { return(NotFound()); } db.KrstTerminis.Remove(krstTermini); db.SaveChanges(); return(Ok(krstTermini)); }
public ActionResult Cenovnik(Cenovnik model) { Cruise cruise = db.Cruises.Include(c => c.krstTermini).Include(c => c.krstPlan).FirstOrDefault(c => c.Id == model.CruiseId); KrstTermini krstTermini = new KrstTermini(); krstTermini.date = model.date; krstTermini.ProzorkaKabina = model.ProzorskaKabina; krstTermini.VnatresnaKabina = model.VnatresnaKabina; krstTermini.BalkonskaKabina = model.BalkonskaKabina; db.SaveChanges(); cruise.krstTermini.Add(krstTermini); db.SaveChanges(); return(RedirectToAction("Details", new { id = model.CruiseId })); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KrstTermini krstTermini = db.KrstTerminis.Include(k => k.cruise).FirstOrDefault(k => k.Id == id); if (krstTermini == null) { return(HttpNotFound()); } ViewBag.CruiseId = new SelectList(db.Cruises, "Id", "Name", krstTermini.CruiseId); return(View(krstTermini)); }