private void PrepareHotel2(LocationModel model) { model.Hotels = context.Hotels.AsQueryable<HolidayPlanner.DAL.Hotel>().Select(x => new SelectListItem() { Text = x.HotelName, Value = x.HotelId.ToString() }); }
public ActionResult AddMapLoc(LocationModel lmodel) { try { HolidayPlanner.DAL.Location lc = new HolidayPlanner.DAL.Location() { LocationId = lmodel.LocationId, LocationName=lmodel.LocationName, Latitude=lmodel.Latitude, Longitude=lmodel.Longitude, HotelId=lmodel.HotelId }; context.Locations.InsertOnSubmit(lc); context.SubmitChanges(); return RedirectToAction("Index"); } catch { return View(lmodel); } }
public ActionResult AddMapLoc() { LocationModel model = new LocationModel(); PrepareHotel2(model); int Lno = context.Locations.Max(x => x.LocationId); int Lno1 = Lno + 1; ViewData["LId"] = Lno1; return View(model); }