protected void Page_Load(object sender, EventArgs e) { int attractionId; bool isFound = false; if (int.TryParse(Request.QueryString["aid"], out attractionId)) { var attraction = service.FindAttraction(attractionId); if (attraction != null) { isFound = true; if (IsAttractionReserved(attractionId)) { pnlConfirm.Visible = false; Message.Text = "Attraction is already reserved."; } else { pnlConfirm.Visible = true; AttractionId.Value = attractionId.ToString(); Message.Text = String.Format("Do you really want to reserve the attraction: name: '{0}'; price: {1} ", attraction.Nazwa, attraction.mCena); } } } if (!isFound) { Message.Text = "Attraction is not found."; } }
// GET: Attractions public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tAtrakcjeUslugi attraction = service.FindAttraction(id.Value); if (attraction == null) { return(HttpNotFound()); } ConfigureViewBag(attraction, AuthorizeUtil.GetUserId(service, User)); return(View(attraction)); }