Ejemplo n.º 1
0
        public ActionResult Create(Hotel hotel)
        {
            if (ModelState.IsValid)
            {
                db.Hotel.AddObject(hotel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.IdState = new SelectList(db.State, "Id", "Name", hotel.IdState);
            return View(hotel);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Hotel EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHotel(Hotel hotel)
 {
     base.AddObject("Hotel", hotel);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new Hotel object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="address">Initial value of the Address property.</param>
 /// <param name="contact">Initial value of the Contact property.</param>
 /// <param name="idState">Initial value of the IdState property.</param>
 /// <param name="active">Initial value of the Active property.</param>
 /// <param name="canSell">Initial value of the CanSell property.</param>
 /// <param name="restaurants">Initial value of the Restaurants property.</param>
 /// <param name="pools">Initial value of the Pools property.</param>
 /// <param name="beach">Initial value of the Beach property.</param>
 /// <param name="parking">Initial value of the Parking property.</param>
 /// <param name="arrivalHour">Initial value of the ArrivalHour property.</param>
 /// <param name="departureHour">Initial value of the DepartureHour property.</param>
 /// <param name="facilities">Initial value of the Facilities property.</param>
 /// <param name="lounges">Initial value of the Lounges property.</param>
 public static Hotel CreateHotel(global::System.Int32 id, global::System.String name, global::System.String description, global::System.String address, global::System.String contact, global::System.Int32 idState, global::System.Boolean active, global::System.Boolean canSell, global::System.Int32 restaurants, global::System.Int32 pools, global::System.Boolean beach, global::System.Boolean parking, global::System.String arrivalHour, global::System.String departureHour, global::System.String facilities, global::System.String lounges)
 {
     Hotel hotel = new Hotel();
     hotel.Id = id;
     hotel.Name = name;
     hotel.Description = description;
     hotel.Address = address;
     hotel.Contact = contact;
     hotel.IdState = idState;
     hotel.Active = active;
     hotel.CanSell = canSell;
     hotel.Restaurants = restaurants;
     hotel.Pools = pools;
     hotel.Beach = beach;
     hotel.Parking = parking;
     hotel.ArrivalHour = arrivalHour;
     hotel.DepartureHour = departureHour;
     hotel.Facilities = facilities;
     hotel.Lounges = lounges;
     return hotel;
 }
Ejemplo n.º 4
0
 public ActionResult Edit(Hotel hotel)
 {
     if (ModelState.IsValid)
     {
         db.Hotel.Attach(hotel);
         db.ObjectStateManager.ChangeObjectState(hotel, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.IdState = new SelectList(db.State, "Id", "Name", hotel.IdState);
     return View(hotel);
 }