/// <summary> /// Create a new BentoBox object. /// </summary> /// <param name="bentoBoxId">Initial value of the BentoBoxId property.</param> /// <param name="bentoBoxName">Initial value of the BentoBoxName property.</param> /// <param name="bentoBoxDescription">Initial value of the BentoBoxDescription property.</param> /// <param name="unitPrice">Initial value of the UnitPrice property.</param> /// <param name="bentoBoxStatusId">Initial value of the BentoBoxStatusId property.</param> public static BentoBox CreateBentoBox(global::System.Int32 bentoBoxId, global::System.String bentoBoxName, global::System.String bentoBoxDescription, global::System.Decimal unitPrice, global::System.Int32 bentoBoxStatusId) { BentoBox bentoBox = new BentoBox(); bentoBox.BentoBoxId = bentoBoxId; bentoBox.BentoBoxName = bentoBoxName; bentoBox.BentoBoxDescription = bentoBoxDescription; bentoBox.UnitPrice = unitPrice; bentoBox.BentoBoxStatusId = bentoBoxStatusId; return bentoBox; }
public ActionResult CreateRestaurant(FormCollection values) { var location = new Location() { LocationName = values["Location_LocationName"], BusinessName = values["Location_LocationName"], Address1 = values["Location_Address1"], Address2 = values["Location_Address2"], City = values["Location_City"], StateOrProvince = values["Location_StateOrProvince"], ZipCode = values["Location_ZipCode"], FirstName = "", LastName = "", Country = "United States", CountryCode= CountryCodeType.US.ToString() }; db.Locations.AddObject(location); DateTime? hoursFrom=null, hoursTo=null, hours2From=null, hours2To=null; if(!string.IsNullOrEmpty(values["RestaurantHoursFrom"])) { hoursFrom = DateTime.Parse(values["RestaurantHoursFrom"]); } if(!string.IsNullOrEmpty(values["RestaurantHoursTo"])) { hoursTo = DateTime.Parse(values["RestaurantHoursTo"]); } if(!string.IsNullOrEmpty(values["RestaurantHours2From"])) { hours2From = DateTime.Parse(values["RestaurantHours2From"]); } if(!string.IsNullOrEmpty(values["RestaurantHours2To"])) { hours2To = DateTime.Parse(values["RestaurantHours2To"]); } var restaurant = new Restaurant() { RestaurantName = values["RestaurantName"], RestaurantShortDescription = values["RestaurantShortDescription"], RestaurantDetailedDescription = values["RestaurantDetailedDescription"], RestaurantHoursFrom = hoursFrom, RestaurantHoursTo = hoursTo, RestaurantHours2From = hours2From, RestaurantHours2To = hours2To, UniversityId = int.Parse(values["UniversityId"]), RestaurantStatusId = (int)Enum.Parse(typeof(RestaurantStatusLevel), values["RestaurantStatus"]), Location = location, RestaurantImageUrl = "", }; db.Restaurants.AddObject(restaurant); var bowl = new BentoBox() { BentoBoxName = "1-Entree Plate", BentoBoxDescription = "1-Entree Plate", BentoBoxTypeId = (int)BentoBoxType.OneEntreePlate, BentoBoxStatusId = (int)BentoBoxStatusLevel.Unavailable, Restaurant = restaurant, BentoBoxImageUrl = "", UnitPrice = 5.99m }; var twoEntree = new BentoBox() { BentoBoxName = "2-Entree Plate", BentoBoxDescription = "2-Entree Plate", BentoBoxTypeId = (int)BentoBoxType.TwoEntreePlate, BentoBoxStatusId = (int)BentoBoxStatusLevel.Unavailable, Restaurant = restaurant, BentoBoxImageUrl = "", UnitPrice = 6.99m }; var threeEntree = new BentoBox() { BentoBoxName = "3-Entree Plate", BentoBoxDescription = "3-Entree Plate", BentoBoxTypeId = (int)BentoBoxType.ThreeEntreePlate, BentoBoxStatusId = (int)BentoBoxStatusLevel.Unavailable, Restaurant = restaurant, BentoBoxImageUrl = "", UnitPrice = 7.99m }; var noodleAndRice = new BentoBox() { BentoBoxName = "Noodle and Rice", BentoBoxDescription = "Noodle and Rice", BentoBoxTypeId = (int)BentoBoxType.NoodleAndRice, BentoBoxStatusId = (int)BentoBoxStatusLevel.Unavailable, Restaurant = restaurant, BentoBoxImageUrl = "", UnitPrice = 6.99m }; db.BentoBoxes.AddObject(bowl); db.BentoBoxes.AddObject(twoEntree); db.BentoBoxes.AddObject(threeEntree); db.BentoBoxes.AddObject(noodleAndRice); db.SaveChanges(); return RedirectToAction("ManageRestaurants"); }
/// <summary> /// Deprecated Method for adding a new object to the BentoBoxes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBentoBoxes(BentoBox bentoBox) { base.AddObject("BentoBoxes", bentoBox); }