Esempio n. 1
0
    protected void btnSubmitMakeRentalRequest_Click(object sender, EventArgs e)
    {
        try
        {
            Entities dbContext = new Entities();
            RentalRequest rentalRequest = new RentalRequest();
            rentalRequest.CustomerId = WebUser.GetInstance().Id;
            rentalRequest.VehicleId = ddlVehicleList.SelectedValue;
            rentalRequest.Description = txtDescription.Text;
            rentalRequest.Status = 0;

            dbContext.RentalRequests.AddObject(rentalRequest);

            dbContext.SaveChanges();

            lblFormResponse.Text = "Your rental request was submitted. Your rental will appear in your Rentals List when accepted by an operator.";

        }
        catch (Exception ex)
        {
            lblFormResponse.Text = ex.Message;
        }
    }
Esempio n. 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the RentalRequests EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRentalRequests(RentalRequest rentalRequest)
 {
     base.AddObject("RentalRequests", rentalRequest);
 }
Esempio n. 3
0
 /// <summary>
 /// Create a new RentalRequest object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="customerId">Initial value of the CustomerId property.</param>
 /// <param name="vehicleId">Initial value of the VehicleId property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static RentalRequest CreateRentalRequest(global::System.Int32 id, global::System.Int32 customerId, global::System.String vehicleId, global::System.String description, global::System.Int32 status)
 {
     RentalRequest rentalRequest = new RentalRequest();
     rentalRequest.Id = id;
     rentalRequest.CustomerId = customerId;
     rentalRequest.VehicleId = vehicleId;
     rentalRequest.Description = description;
     rentalRequest.Status = status;
     return rentalRequest;
 }