public ActionResult DeleteConfirmed(int id) { ArrangementPrice arrangementPrice = db.ArrangementPrices.Find(id); db.ArrangementPrices.Remove(arrangementPrice); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,HotelId,date,price")] ArrangementPrice arrangementPrice) { if (ModelState.IsValid) { db.Entry(arrangementPrice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HotelId = new SelectList(db.Hotels, "Id", "Name", arrangementPrice.HotelId); return(View(arrangementPrice)); }
public ActionResult Create([Bind(Include = "Id,HotelId,date,price")] ArrangementPrice arrangementPrice) { if (ModelState.IsValid) { db.ArrangementPrices.Add(arrangementPrice); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HotelId = new SelectList(db.Hotels, "Id", "Name", arrangementPrice.HotelId); return(View(arrangementPrice)); }
// GET: ArrangementPrices/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArrangementPrice arrangementPrice = db.ArrangementPrices.Find(id); if (arrangementPrice == null) { return(HttpNotFound()); } return(View(arrangementPrice)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArrangementPrice arrangementPrice = db.ArrangementPrices.Find(id); if (arrangementPrice == null) { return(HttpNotFound()); } ViewBag.HotelId = new SelectList(db.Hotels, "Id", "Name", arrangementPrice.HotelId); return(View(arrangementPrice)); }
public ActionResult AddArrangement(AddArangement model) { Hotel hotel = db.Hotels.Find(model.HotelId); ArrangementPrice price = new ArrangementPrice(); price.date = model.dateTime; price.price = model.price; price.HotelId = model.HotelId; price.hotel = hotel; db.ArrangementPrices.Add(price); db.SaveChanges(); var terminCenaOdBaza = db.ArrangementPrices.FirstOrDefault(t => t.date == model.dateTime && t.price == model.price); hotel.arrangements.Add(terminCenaOdBaza); db.SaveChanges(); return(RedirectToAction("Details", new { id = model.HotelId })); }