Esempio n. 1
0
        public ActionResult Create(Room room)
        {
            if (ModelState.IsValid)
            {
                db.Room.AddObject(room);
                db.SaveChanges();
                return RedirectToAction("Index", new { id = room.IdHotel });
            }

            ViewBag.Hotel = db.Hotel.SingleOrDefault(u => u.Id.Equals(room.IdHotel));
            return View(room);
        }
Esempio n. 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Room EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRoom(Room room)
 {
     base.AddObject("Room", room);
 }
Esempio n. 3
0
 /// <summary>
 /// Create a new Room 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="idHotel">Initial value of the IdHotel property.</param>
 /// <param name="active">Initial value of the Active property.</param>
 public static Room CreateRoom(global::System.Int32 id, global::System.String name, global::System.String description, global::System.Int32 idHotel, global::System.Boolean active)
 {
     Room room = new Room();
     room.Id = id;
     room.Name = name;
     room.Description = description;
     room.IdHotel = idHotel;
     room.Active = active;
     return room;
 }
Esempio n. 4
0
 public ActionResult Edit(Room room)
 {
     if (ModelState.IsValid)
     {
         db.Room.Attach(room);
         db.ObjectStateManager.ChangeObjectState(room, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index", new { id = room.IdHotel });
     }
     return View(room);
 }