Exemplo n.º 1
0
 /// <summary>
 /// Create a new cg_Products_Dates object.
 /// </summary>
 /// <param name="productDateId">Initial value of the ProductDateId property.</param>
 /// <param name="departureDate">Initial value of the DepartureDate property.</param>
 /// <param name="returnDate">Initial value of the ReturnDate property.</param>
 /// <param name="miniPersons">Initial value of the MiniPersons property.</param>
 /// <param name="note">Initial value of the Note property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="flightPrice">Initial value of the FlightPrice property.</param>
 public static cg_Products_Dates Createcg_Products_Dates(global::System.Int64 productDateId, global::System.DateTime departureDate, global::System.DateTime returnDate, global::System.Int32 miniPersons, global::System.String note, global::System.Decimal price, global::System.Decimal flightPrice)
 {
     cg_Products_Dates cg_Products_Dates = new cg_Products_Dates();
     cg_Products_Dates.ProductDateId = productDateId;
     cg_Products_Dates.DepartureDate = departureDate;
     cg_Products_Dates.ReturnDate = returnDate;
     cg_Products_Dates.MiniPersons = miniPersons;
     cg_Products_Dates.Note = note;
     cg_Products_Dates.Price = price;
     cg_Products_Dates.FlightPrice = flightPrice;
     return cg_Products_Dates;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the cg_Products_Dates EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTocg_Products_Dates(cg_Products_Dates cg_Products_Dates)
 {
     base.AddObject("cg_Products_Dates", cg_Products_Dates);
 }
Exemplo n.º 3
0
        public ActionResult product_dates_add(FormCollection collection)
        {
            long ProductId = Convert.ToInt64(collection["ProductId"]);
            cg_Products product = db.cg_Products.Where(p => p.ProductId == ProductId).FirstOrDefault();
            cg_Products_Dates newItem = new cg_Products_Dates();

            // Add item info
            string[] dep_date = collection["date_departure"].Split('/');
            int dep_year = Convert.ToInt32(dep_date[2]);
            int dep_month = Convert.ToInt32(dep_date[1]);
            int dep_day = Convert.ToInt32(dep_date[0]);

            string[] ret_date = collection["date_return"].Split('/');
            int ret_year = Convert.ToInt32(ret_date[2]);
            int ret_month = Convert.ToInt32(ret_date[1]);
            int ret_day = Convert.ToInt32(ret_date[0]);

            newItem.DepartureDate = new DateTime(dep_year, dep_month, dep_day);
            newItem.ReturnDate = new DateTime(ret_year, ret_month, ret_day);
            newItem.Price = Convert.ToDecimal(collection["date_price"]);
            newItem.FlightPrice = Convert.ToDecimal(collection["flight_price"]);
            newItem.Note = "";
            newItem.MiniPersons = Convert.ToInt32(collection["mini_pers"]);

            // Add object
            product.cg_Products_Dates.Add(newItem);
            db.SaveChanges();

            return RedirectToAction("product_edit", new { id = ProductId });
        }