Beispiel #1
0
        public ActionResult Create(Period period)
        {
            if (ModelState.IsValid)
            {
                db.Period.AddObject(period);
                db.SaveChanges();
                return RedirectToAction("Index", new { IdHotel = period.IdHotel });
            }

            ViewBag.IdHotel = new SelectList(db.Hotel, "Id", "Name", period.IdHotel);
            return View(period);
        }
Beispiel #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Period EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPeriod(Period period)
 {
     base.AddObject("Period", period);
 }
Beispiel #3
0
 /// <summary>
 /// Create a new Period object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="beginDay">Initial value of the BeginDay property.</param>
 /// <param name="endDay">Initial value of the EndDay property.</param>
 /// <param name="idHotel">Initial value of the IdHotel property.</param>
 /// <param name="beginMonth">Initial value of the BeginMonth property.</param>
 /// <param name="endMonth">Initial value of the EndMonth property.</param>
 public static Period CreatePeriod(global::System.Int32 id, global::System.Int32 beginDay, global::System.Int32 endDay, global::System.Int32 idHotel, global::System.Int32 beginMonth, global::System.Int32 endMonth)
 {
     Period period = new Period();
     period.Id = id;
     period.BeginDay = beginDay;
     period.EndDay = endDay;
     period.IdHotel = idHotel;
     period.BeginMonth = beginMonth;
     period.EndMonth = endMonth;
     return period;
 }
Beispiel #4
0
 public ActionResult Edit(Period period)
 {
     if (ModelState.IsValid)
     {
         db.Period.Attach(period);
         db.ObjectStateManager.ChangeObjectState(period, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index", new { IdHotel = period.IdHotel });
     }
     ViewBag.IdHotel = new SelectList(db.Hotel, "Id", "Name", period.IdHotel);
     return View(period);
 }